Part Number Hot Search : 
B560C AT49F 101EF SM5002L IR2175 MBR1060 D29NF03L 805SF
Product Description
Full Text Search
 

To Download R4F2164 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  revision date: mar. 17, 2008 16 hardware manual renesas 16-bit single-chip microcomputer h8s family / h8s/2400 series h8s/2164 R4F2164 rev.1.00 rej09b0429-0100 h8s/2164 group
rev. 1.00 mar. 17, 2008 page ii of xl
rev. 1.00 mar. 17, 2008 page iii of xl 1. this document is provided for reference purposes only so that renesas customers may select the appropriate renesas products for their use. renesas neither makes warranties or representations with respect to the accuracy or completeness of the information contained in this document nor grants any license to any intellectual property rights or any other rights of renesas or any third party with respect to the information in this document. 2. renesas shall have no liability for damages or infringement of any intellectual property or other rights arising out of the use of any information in this document, including, but not limited to, product data, diagrams, charts, programs, algorithms, and application circuit examples. 3. you should not use the products or the technology described in this document for the purpose of military applications such as the development of weapons of mass destruction or for the purpose of any other military use. when exporting the products or technology described herein, you should follow the applicable export control laws and regulations, and procedures required by such laws and regulations. 4. all information included in this document such as product data, diagrams, charts, programs, algorithms, and application circuit examples, is current as of the date this document is issued. such information, however, is subject to change without any prior notice. before purchasing or using any renesas products listed in this document, please confirm the latest product information with a renesas sales office. also, please pay regular and careful attention to additional and different information to be disclosed by renesas such as that disclosed through our website. (http://www.renesas.com ) 5. renesas has used reasonable care in compiling the information included in this document, but renesas assumes no liability whatsoever for any damages incurred as a result of errors or omissions in the information included in this document. 6. when using or otherwise relying on the information in this document, you should evaluate the information in light of the total system before deciding about the applicability of such information to the intended application. renesas makes no representations, warranties or guaranties regarding the suitability of its products for any particular application and specifically disclaims any liability arising out of the application and use of the information in this document or renesas products. 7. with the exception of products specified by renesas as suitable for automobile applications, renesas products are not designed, manufactured or tested for applications or otherwise in systems the failure or malfunction of which may cause a direct threat to human life or create a risk of human injury or which require especially high quality and reliability such as safety systems, or equipment or systems for transportation and traffic, healthcare, combustion control, aerospace and aeronautics, nuclear power, or undersea communication transmission. if you are considering the use of our products for such purposes, please contact a renesas sales office beforehand. renesas shall have no liability for damages arising out of the uses set forth above. 8. notwithstanding the preceding paragraph, you should not use renesas products for the purposes listed below: (1) artificial life support devices or systems (2) surgical implantations (3) healthcare intervention (e.g., excision, administration of medication, etc.) (4) any other purposes that pose a direct threat to human life renesas shall have no liability for damages arising out of the uses set forth in the above and purchasers who elect to use renesas products in any of the foregoing applications shall indemnify and hold harmless renesas technology corp., its affiliated companies and their officers, directors, and employees against any and all damages arising out of such applications. 9. you should use the products described herein within the range specified by renesas, especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. renesas shall have no liability for malfunctions or damages arising out of the use of renesas products beyond such specified ranges. 10. although renesas endeavors to improve the quality and reliability of its products, ic products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. please be sure to implement safety measures to guard against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a renesas product, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other applicable measures. among others, since the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you. 11. in case renesas products listed in this document are detached from the products to which the renesas products are attached or affixed, the risk of accident such as swallowing by infants and small children is very high. you should implement safety measures so that renesas products may not be easily detached from your products. renesas shall have no liability for damages arising out of such detachment. 12. this document may not be reproduced or duplicated, in any form, in whole or in part, without prior written approval from renesas. 13. please contact a renesas sales office if you have any questions regarding the information contained in this document, renesas semiconductor products, or if you have any other inquiries. notes regarding these materials
rev. 1.00 mar. 17, 2008 page iv of xl general precautions on handling of product 1. treatment of nc pins note: do not connect anything to the nc pins. the nc (not connected) pins are either not connected to any of the internal circuitry or are used as test pins or to reduce noise. if something is connected to the nc pins, the operation of the lsi is not guaranteed. 2. treatment of unused input pins note: fix all unused input pins to high or low level. generally, the input pins of cmos products are high-impedance input pins. if unused pins are in their open states, intermediate levels are induced by noise in the vicinity, a pass- through current flows internally, and a malfunction may occur. 3. processing before initialization note: when power is first supplied, the product's state is undefined. the states of internal circuits are undefined until full power is supplied throughout the chip and a low level is input on the reset pi n. during the period where the states are undefined, the register settings and the output state of each pin are also undefined. design your system so that it does not malfunction because of processing while it is in this undefined state. for those products which have a reset function, reset the lsi immediately after the power supply has been turned on. 4. prohibition of access to undefined or reserved addresses note: access to undefined or reserved addresses is prohibited. the undefined or reserved addresses may be used to expand functions, or test registers may have been be allocated to these addresse s. do not access these registers; the system's operation is not guaranteed if they are accessed.
rev. 1.00 mar. 17, 2008 page v of xl configuration of this manual this manual comprises the following items: 1. general precautions on handling of product 2. configuration of this manual 3. preface 4. contents 5. overview 6. description of functional modules ? cpu and system-control modules ? on-chip peripheral modules the configuration of the functional description of each module differs according to the module. however, the generic style includes the following items: i) feature ii) input/output pin iii) register description iv) operation v) usage note when designing an application system that includes this lsi, take notes into account. each section includes notes in relation to the descriptions given, and usage notes are given, as required, as the final part of each section. 7. list of registers 8. electrical characteristics 9. appendix 10. main revisions and additions in this edition (only for revised versions) the list of revisions is a summary of points that have been revised or added to earlier versions. this does not include all of the revised contents . for details, see the actual locations in this manual. 11. index
rev. 1.00 mar. 17, 2008 page vi of xl preface the h8s/2164 group products are single-chip microcomputers made up of the high-speed h8s/2600 cpu employing renesas technology original architecture as its core, and the peripheral functions required to configure a system. the h8s/2600 cpu has an instruction set that is compatible with the h8/300 and h8/300h cpus. target users: this manual was written for users who will be using the h8s/2164 group in the design of application syst ems. target users are exp ected to understand the fundamentals of electrical circuits, logical circuits, and microcomputers. objective: this manual was written to explain the hardwa re functions and electrical characteristics of the h8s/2164 group to the target users. refer to the h8s/2600 series, h8s/2000 series software manual for a detailed description of the instruction set. notes on reading this manual: ? in order to understand the overall functions of the chip read the manual according to the contents. this manual can be roughly categorized into parts on the cpu, system control functions, periph eral functions and elect rical characteristics. ? in order to understand the details of the cpu?s functions read the h8s/2600 series, h8s/ 2000 series software manual. ? in order to understand the details of a register when its name is known read the index that is the final part of the manual to find the page number of the entry on the register. the addresses, bits, and initial values of the registers are summarized in section 25, list of registers. examples: register name: the following notatio n is used for cases when the same or a similar function, e.g. 16-bit timer pulse unit or serial communication, is implemented on more than one channel: xxx_n (xxx is the register name and n is the channel number) bit order: the msb is on the left and the lsb is on the right. related manuals: the latest versions of all related manuals are available from our web site. please ensure you have the latest versions of all documents you require. http://www.renesas.com/
rev. 1.00 mar. 17, 2008 page vii of xl h8s/2164 group manuals: document title document no. h8s/2164 group hardware manual this manual h8s/2600 series, h8s/2000 series software manual rej09b0139 user?s manuals for development tools: document title document no. h8s, h8/300 series c/c++ compiler, assembler, optimizing linkage editor user's manual rej10b0058 microcomputer development environment system h8s, h8/300 series simulator/debugger user's manual ade-702-282 h8s, h8/300 series high-performance embedded workshop 3 tutorial rej10b0024 h8s, h8/300 series high-performance embedded workshop 3 user's manual rej10b0026 all trademarks and registered trademarks ar e the property of th eir respective owners.
rev. 1.00 mar. 17, 2008 page viii of xl
rev. 1.00 mar. 17, 2008 page ix of xl contents section 1 overview................................................................................................1 1.1 overview....................................................................................................................... ......... 1 1.2 block diagram .................................................................................................................. ..... 2 1.3 pin descri ption................................................................................................................ ....... 3 1.3.1 pin assign ment ......................................................................................................... 3 1.3.2 pin assignment in ea ch operating mode................................................................. 4 1.3.3 pin functions .......................................................................................................... 10 section 2 cpu......................................................................................................17 2.1 features....................................................................................................................... ......... 17 2.1.1 differences between h8s/2600 cpu and h8s/2000 cpu ..................................... 18 2.1.2 differences from h8/300 cpu ............................................................................... 19 2.1.3 differences from h8/300h cpu............................................................................. 19 2.2 cpu operating modes......................................................................................................... 20 2.2.1 normal mode.......................................................................................................... 20 2.2.2 advanced mode...................................................................................................... 22 2.3 address space.................................................................................................................. .... 24 2.4 registers...................................................................................................................... ......... 25 2.4.1 general registers.................................................................................................... 26 2.4.2 program counter (pc) ............................................................................................ 27 2.4.3 extended control re gister (exr) .......................................................................... 27 2.4.4 condition-code re gister (ccr)............................................................................. 28 2.4.5 multiply-accumulate register (mac)................................................................... 29 2.4.6 initial values of cpu regist ers .............................................................................. 29 2.5 data formats................................................................................................................... ..... 30 2.5.1 general register data formats ............................................................................... 30 2.5.2 memory data formats ............................................................................................ 32 2.6 instruction set ................................................................................................................ ...... 33 2.6.1 table of instructions cl assified by function .......................................................... 34 2.6.2 basic instructio n formats ....................................................................................... 44 2.7 addressing modes and effec tive address ca lculation........................................................ 45 2.7.1 register direct ? rn ............................................................................................... 45 2.7.2 register indirect ? @ern ....................................................................................... 45 2.7.3 register indirect with displacement ? @(d:16, ern) or @(d:32, ern)................. 46 2.7.4 register indirect with post -increment or pre-decrement ? @ern+ or @-ern..... 46 2.7.5 absolute address ? @aa:8, @aa:16, @aa: 24, or @aa:32....................................... 46 2.7.6 immediate ? #xx:8, #xx:16, or #xx:32.................................................................... 47 2.7.7 program-counter relative ? @(d:8, pc) or @(d:16, pc)....................................... 47 2.7.8 memory indirect ? @@aa:8 ................................................................................... 48 2.7.9 effective address calculation ................................................................................ 49
rev. 1.00 mar. 17, 2008 page x of xl 2.8 processing states.............................................................................................................. .... 51 2.9 usage note..................................................................................................................... ...... 53 2.9.1 notes on using the bit op eration instruction......................................................... 53 section 3 mcu operating modes ....................................................................... 55 3.1 operating mode selection ................................................................................................... 55 3.2 register de scriptions.......................................................................................................... .56 3.2.1 mode control regi ster (mdcr) ............................................................................ 56 3.2.2 system control re gister (s yscr)......................................................................... 57 3.2.3 serial timer control register (stcr) ................................................................... 58 3.3 operating mode descriptions .............................................................................................. 60 3.3.1 mode 2.................................................................................................................... 60 3.4 address map .................................................................................................................... .... 61 section 4 exception handling ............................................................................. 63 4.1 exception handling t ypes and priority............................................................................... 63 4.2 exception sources and ex ception vector table .................................................................. 64 4.3 reset .......................................................................................................................... .......... 66 4.3.1 reset exceptio n handling ...................................................................................... 66 4.3.2 interrupts after reset............................................................................................... 67 4.3.3 on-chip peripheral modules af ter reset is cancelled ........................................... 67 4.4 interrupt exception handling .............................................................................................. 68 4.5 trap instruction ex ception ha ndling................................................................................... 68 4.6 stack status after ex ception ha ndling................................................................................. 69 4.7 usage note..................................................................................................................... ...... 70 section 5 interrupt controller.............................................................................. 71 5.1 features....................................................................................................................... ......... 71 5.2 input/output pins.............................................................................................................. ... 72 5.3 register de scriptions.......................................................................................................... .73 5.3.1 interrupt control registers a to d (icra to icrd).............................................. 73 5.3.2 address break control register (a brkcr) ......................................................... 74 5.3.3 break address registers a to c (bara to barc)............................................... 75 5.3.4 irq sense control registers (iscr 16h, iscr16l, iscrh, iscrl)................... 76 5.3.5 irq enable register s (ier16, ier) ....................................................................... 78 5.3.6 irq status register s (isr16, isr)......................................................................... 79 5.4 interrupt sources.............................................................................................................. .... 80 5.4.1 external interrupts .................................................................................................. 80 5.4.2 internal interrupts ................................................................................................... 81 5.5 interrupt exception hand ling vector table......................................................................... 82 5.6 interrupt control modes an d interrupt operation ................................................................ 84 5.6.1 interrupt control mode 0........................................................................................ 86 5.6.2 interrupt control mode 1........................................................................................ 88 5.6.3 interrupt exception handling sequence ................................................................. 91
rev. 1.00 mar. 17, 2008 page xi of xl 5.6.4 interrupt respon se times ....................................................................................... 93 5.6.5 dtc activation by interrupt................................................................................... 94 5.7 usage notes .................................................................................................................... ..... 96 5.7.1 conflict between interrupt ge neration and disabling ............................................ 96 5.7.2 instructions that di sable interrupts ......................................................................... 97 5.7.3 interrupts during execution of eepmov in struction............................................. 97 5.7.4 irq status register s (isr16, isr) ......................................................................... 97 section 6 bus controller (bsc)...........................................................................99 6.1 features....................................................................................................................... ......... 99 6.2 input/output pins .............................................................................................................. .102 6.3 register desc riptions ......................................................................................................... 1 03 6.3.1 bus control regi ster ( bcr) ................................................................................. 103 6.3.2 bus control regist er 2 (bcr2) ............................................................................ 105 6.3.3 wait state control re gister (w scr) ................................................................... 106 6.3.4 wait state control regi ster 2 (ws cr2) .............................................................. 108 6.3.5 system control regist er 2 (syscr2) .................................................................. 109 6.4 bus control .................................................................................................................... .... 110 6.4.1 bus specifica tions................................................................................................. 110 6.4.2 advanced mode.................................................................................................... 117 6.4.3 i/o select signals .................................................................................................. 118 6.5 bus interface .................................................................................................................. .... 119 6.5.1 data size and data alignment.............................................................................. 119 6.5.2 valid strobes ........................................................................................................ 121 6.5.3 valid strobes (in glue less extension) .................................................................. 122 6.5.4 basic operation timing in normal extended mode ............................................ 123 6.5.5 basic operation timing in address- data multiplex extended mode .................. 134 6.5.6 wait cont rol ......................................................................................................... 142 6.6 burst rom in terface.......................................................................................................... 14 6 6.6.1 basic operatio n timing........................................................................................ 146 6.6.2 wait cont rol ......................................................................................................... 147 6.7 idle cycle..................................................................................................................... ...... 148 6.8 bus arbitr ati on................................................................................................................ ... 149 6.8.1 overview............................................................................................................... 149 6.8.2 operation .............................................................................................................. 149 6.8.3 bus mastership tran sfer timing .......................................................................... 150 section 7 data transf er controller (dtc) ........................................................151 7.1 features....................................................................................................................... ....... 151 7.2 register desc riptions ......................................................................................................... 1 53 7.2.1 dtc mode register a (mra) ............................................................................. 154 7.2.2 dtc mode regist er b (m rb).............................................................................. 155 7.2.3 dtc source address re gister (sar)................................................................... 155 7.2.4 dtc destination address register (d ar)........................................................... 155
rev. 1.00 mar. 17, 2008 page xii of xl 7.2.5 dtc transfer count re gister a (cra) ............................................................... 156 7.2.6 dtc transfer count re gister b (crb)................................................................ 156 7.2.7 dtc enable regist ers (dtcer ).......................................................................... 156 7.2.8 dtc vector regist er (dtvecr)......................................................................... 157 7.2.9 keyboard comparator contro l register (kbcomp)........................................... 158 7.2.10 event counter control register (eccr).............................................................. 159 7.2.11 event counter status register (e cs) ................................................................... 160 7.3 dtc event co unter ........................................................................................................... 161 7.3.1 event counter handli ng prior ity .......................................................................... 162 7.3.2 usage notes .......................................................................................................... 163 7.4 activation sources............................................................................................................. 163 7.5 location of register informati on and dtc vector table ................................................. 165 7.6 operation ...................................................................................................................... ..... 167 7.6.1 normal mode........................................................................................................ 168 7.6.2 repeat mo de......................................................................................................... 169 7.6.3 block transfer mode ............................................................................................ 170 7.6.4 chain transfer ...................................................................................................... 171 7.6.5 interrupt sources................................................................................................... 172 7.6.6 operation timing.................................................................................................. 172 7.6.7 number of dtc exec ution stat es ........................................................................ 173 7.7 procedures for using dtc................................................................................................. 175 7.7.1 activation by in terrupt.......................................................................................... 175 7.7.2 activation by software ......................................................................................... 175 7.8 examples of use of the dtc ............................................................................................. 176 7.8.1 normal mode........................................................................................................ 176 7.8.2 software activ ation .............................................................................................. 177 7.9 usage notes .................................................................................................................... ... 178 7.9.1 module stop m ode setting ................................................................................... 178 7.9.2 on-chip ram ...................................................................................................... 178 7.9.3 dtce bit se tting.................................................................................................. 178 7.9.4 dtc activation by interrupt sources of sci, iic, or a/d converter .................. 178 section 8 i/o ports............................................................................................. 179 8.1 port 1......................................................................................................................... ......... 184 8.1.1 port 1 data direction register (p1ddr).............................................................. 184 8.1.2 port 1 data regi ster (p1dr) ................................................................................ 185 8.1.3 port 1 pull-up mos contro l register (p1pcr) ................................................... 185 8.1.4 pin functio ns ........................................................................................................ 186 8.1.5 port 1 input pu ll-up mos .................................................................................... 186 8.2 port 2......................................................................................................................... ......... 187 8.2.1 port 2 data direction register (p2ddr).............................................................. 187 8.2.2 port 2 data regi ster (p2dr) ................................................................................ 188 8.2.3 port 2 pull-up mos contro l register (p2pcr) ................................................... 188 8.2.4 pin functio ns ........................................................................................................ 189
rev. 1.00 mar. 17, 2008 page xiii of xl 8.2.5 port 2 input pu ll-up mos .................................................................................... 190 8.3 port 3......................................................................................................................... ......... 191 8.3.1 port 3 data direction register (p3ddr).............................................................. 191 8.3.2 port 3 data regi ster (p3dr)................................................................................. 192 8.3.3 port 3 pull-up mos contro l register (p3pcr) ................................................... 192 8.3.4 pin functions ........................................................................................................ 193 8.3.5 port 3 input pu ll-up mos .................................................................................... 193 8.4 port 4......................................................................................................................... ......... 194 8.4.1 port 4 data direction register (p4ddr).............................................................. 194 8.4.2 port 4 data regi ster (p4dr)................................................................................. 195 8.4.3 port 4 pull-up mos contro l register (p4pcr) ................................................... 195 8.4.4 pin functions ........................................................................................................ 196 8.5 port 5......................................................................................................................... ......... 197 8.5.1 port 5 data direction register (p5ddr).............................................................. 197 8.5.2 port 5 data regi ster (p5dr)................................................................................. 198 8.5.3 pin functions ........................................................................................................ 198 8.6 port 6......................................................................................................................... ......... 203 8.6.1 port 6 data direction register (p6ddr).............................................................. 203 8.6.2 port 6 data regi ster (p6dr)................................................................................. 204 8.6.3 port 6 pull-up mos contro l register (p6pcr) ................................................... 204 8.6.4 noise canceler enable register (p 6nce)............................................................ 205 8.6.5 noise canceler mode contro l register (p 6ncmc) ............................................. 205 8.6.6 noise canceler cycle settin g register (nccs) ................................................... 206 8.6.7 pin functions ........................................................................................................ 207 8.6.8 port 6 input pu ll-up mos .................................................................................... 210 8.7 port 7......................................................................................................................... ......... 211 8.7.1 port 7 input data re gister (p7pin) ...................................................................... 211 8.7.2 pin functions ........................................................................................................ 212 8.8 port 8......................................................................................................................... ......... 216 8.8.1 port 8 data direction register (p8ddr).............................................................. 216 8.8.2 port 8 data regi ster (p8dr)................................................................................. 217 8.8.3 pin functions ........................................................................................................ 217 8.9 port 9......................................................................................................................... ......... 221 8.9.1 port 9 data direction register (p9ddr).............................................................. 221 8.9.2 port 9 data regi ster (p9dr)................................................................................. 222 8.9.3 pin functions ........................................................................................................ 222 8.10 port a......................................................................................................................... ........ 226 8.10.1 port a data direction register (p addr) ............................................................ 226 8.10.2 port a output data re gister (paodr) ................................................................ 227 8.10.3 port a input data re gister (papin)..................................................................... 227 8.10.4 pin functions ........................................................................................................ 228 8.10.5 input pull-up mos............................................................................................... 230 8.11 port b ......................................................................................................................... ........ 231 8.11.1 port b data direction register (p bddr) ............................................................ 231
rev. 1.00 mar. 17, 2008 page xiv of xl 8.11.2 port b output data re gister (pbo dr) ................................................................ 232 8.11.3 port b input data re gister (pbp in)..................................................................... 232 8.11.4 pin functio ns ........................................................................................................ 233 8.12 port c ......................................................................................................................... ........ 234 8.12.1 port c data direction register (p cddr) ............................................................ 234 8.12.2 port c output data re gister (pco dr) ................................................................ 235 8.12.3 port c input data re gister (pcp in)..................................................................... 235 8.12.4 pin functio ns ........................................................................................................ 236 8.13 port d......................................................................................................................... ........ 239 8.13.1 port d data direction register (p dddr)............................................................ 239 8.13.2 port d output data re gister (pdodr)................................................................ 240 8.13.3 port d input data re gister (pdpin) .................................................................... 240 8.13.4 pin functio ns ........................................................................................................ 241 8.13.5 input pull-up mos............................................................................................... 243 8.14 port e ......................................................................................................................... ........ 244 8.14.1 port e data direction register (peddr)............................................................. 244 8.14.2 port e output data re gister (peodr)................................................................. 245 8.14.3 port e input data re gister (pepin) ..................................................................... 245 8.14.4 pin functio ns ........................................................................................................ 246 8.15 port f ......................................................................................................................... ........ 249 8.15.1 port f data direction register (pfddr) ............................................................. 249 8.15.2 port f output data re gister (pfodr) ................................................................. 249 8.15.3 port f input data re gister (pfpin)...................................................................... 250 8.15.4 pin functio ns ........................................................................................................ 250 8.16 change of periphera l function pins................................................................................... 251 8.16.1 irq sense port select register 16 (issr16), irq sense port select register (issr) ................................................................ 251 8.16.2 port control regist er 0 (ptcnt0) ....................................................................... 253 section 9 14-bit pwm timer (pwmx) ........................................................... 255 9.1 features....................................................................................................................... ....... 255 9.2 input/output pins.............................................................................................................. .256 9.3 register desc riptions......................................................................................................... 2 56 9.3.1 pwmx (d/a) counter (dacnt) ........................................................................ 257 9.3.2 pwmx (d/a) data registers a and b (dadra and dadrb) ......................... 258 9.3.3 pwmx (d/a) control re gister (dacr) ............................................................. 260 9.3.4 peripheral clock select register (pcsr) ............................................................. 261 9.4 bus master interface.......................................................................................................... 2 62 9.5 operation ...................................................................................................................... ..... 263 section 10 16-bit free-running timer (frt).................................................. 271 10.1 features....................................................................................................................... ....... 271 10.2 register desc riptions......................................................................................................... 2 73 10.2.1 free-running coun ter (frc) ............................................................................... 273
rev. 1.00 mar. 17, 2008 page xv of xl 10.2.2 output compare registers a and b (ocra an d ocrb) .................................... 273 10.2.3 output compare registers ar an d af (ocrar and ocraf) .......................... 274 10.2.4 timer interrupt enable register (tier) ............................................................... 275 10.2.5 timer control/status re gister (tcsr)................................................................. 276 10.2.6 timer control regi ster (tcr).............................................................................. 277 10.2.7 timer output compare cont rol register (tocr) ............................................... 278 10.3 operation timing............................................................................................................... 279 10.3.1 frc increment timing ......................................................................................... 279 10.3.2 output compare output timing ........................................................................... 279 10.3.3 frc clear ti ming ................................................................................................ 280 10.3.4 timing of output compare flag (ocf) se tting ................................................... 280 10.3.5 timing of frc overflow flag (ovf) setting...................................................... 281 10.3.6 automatic additi on timing.................................................................................. 282 10.4 interrupt sources.............................................................................................................. .. 282 10.5 usage notes .................................................................................................................... ... 283 10.5.1 conflict between frc write and clear ................................................................ 283 10.5.2 conflict between frc write and increment......................................................... 284 10.5.3 conflict between ocr write and compare- match .............................................. 285 10.5.4 switching of internal cloc k and frc oper ation .................................................. 286 section 11 8-bit timer (tmr) ..........................................................................289 11.1 features....................................................................................................................... ....... 289 11.2 register desc riptions ......................................................................................................... 2 92 11.2.1 timer counter (tcnt)......................................................................................... 292 11.2.2 time constant regist er a (tcora).................................................................... 293 11.2.3 time constant regi ster b (t corb) .................................................................... 293 11.2.4 timer control regi ster (tcr).............................................................................. 294 11.2.5 timer control/status re gister (tcsr)................................................................. 297 11.2.6 timer connection regist er s (tconrs)............................................................. 301 11.3 operation timing............................................................................................................... 302 11.3.1 tcnt count timing ............................................................................................ 302 11.3.2 timing of cmfa and cmfb se tting at compar e-match .................................... 302 11.3.3 timing of counter clear at compare- match ........................................................ 303 11.3.4 timing of overflow fl ag (ovf) se tting .............................................................. 303 11.4 tmr_0 and tmr_1 cascad ed connec tion ....................................................................... 304 11.4.1 16-bit count mode ............................................................................................... 304 11.4.2 compare-match co unt mode ............................................................................... 304 11.5 interrupt sources.............................................................................................................. .. 305 11.6 usage notes .................................................................................................................... ... 306 11.6.1 conflict between tcnt writ e and counte r clear................................................ 306 11.6.2 conflict between tcnt wr ite and increment...................................................... 307 11.6.3 conflict between tcor write and compare-match............................................ 308 11.6.4 switching of internal clocks and tcnt op eration.............................................. 309 11.6.5 mode setting with casc aded connec tion ............................................................. 310
rev. 1.00 mar. 17, 2008 page xvi of xl section 12 watchdog timer (wdt) ................................................................. 311 12.1 features....................................................................................................................... ....... 311 12.2 input/output pins.............................................................................................................. .313 12.3 register desc riptions......................................................................................................... 3 13 12.3.1 timer counter (tcnt)......................................................................................... 313 12.3.2 timer control/status re gister (tcsr)................................................................. 314 12.4 operation ...................................................................................................................... ..... 318 12.4.1 watchdog time r mode......................................................................................... 318 12.4.2 interval timer mode............................................................................................. 320 12.4.3 reso signal output timing ................................................................................ 321 12.5 interrupt sources.............................................................................................................. .. 322 12.6 usage notes .................................................................................................................... ... 323 12.6.1 notes on regist er access ..................................................................................... 323 12.6.2 conflict between timer counter (t cnt) write and increment........................... 324 12.6.3 changing values of ck s2 to cks0 bits.............................................................. 324 12.6.4 changing value of pss bit .................................................................................. 324 12.6.5 switching between watchdog timer m ode and interval timer mode................. 325 12.6.6 system reset by reso signal ............................................................................. 325 section 13 serial communication interface (sci)............................................ 327 13.1 features....................................................................................................................... ....... 327 13.2 input/output pins.............................................................................................................. .330 13.3 register desc riptions......................................................................................................... 3 30 13.3.1 receive shift regi ster (rsr) ............................................................................... 331 13.3.2 receive data regi ster (rdr)............................................................................... 331 13.3.3 transmit data regi ster (tdr).............................................................................. 331 13.3.4 transmit shift regi ster (tsr) .............................................................................. 331 13.3.5 serial mode regi ster (smr) ................................................................................ 332 13.3.6 serial control re gister (s cr) .............................................................................. 335 13.3.7 serial status regi ster (ssr) ................................................................................. 338 13.3.8 smart card mode re gister (s cmr)..................................................................... 342 13.3.9 bit rate regist er (brr) ....................................................................................... 343 13.4 operation in asynch ronous mode ..................................................................................... 347 13.4.1 data transfer format............................................................................................ 348 13.4.2 receive data sampling timing and reception margin in asynchronous mode............................................................................................. 349 13.4.3 clock..................................................................................................................... 350 13.4.4 sci initialization (async hronous mode).............................................................. 351 13.4.5 serial data transmission (asynchronous mode) ................................................. 352 13.4.6 serial data reception (a synchronous mode) ...................................................... 354 13.5 multiprocessor communi cation func tion.......................................................................... 358 13.5.1 multiprocessor serial da ta transmission ............................................................. 360 13.5.2 multiprocessor serial data reception .................................................................. 361 13.6 operation in clock sy nchronous mode............................................................................. 365
rev. 1.00 mar. 17, 2008 page xvii of xl 13.6.1 clock..................................................................................................................... 365 13.6.2 sci initialization (clock synchronous mode)...................................................... 366 13.6.3 serial data transmission (c lock synchronous mode) ......................................... 367 13.6.4 serial data reception (clock synchronous mode) .............................................. 370 13.6.5 simultaneous serial data tr ansmission and reception (clock synchronous mode) .................................................................................. 372 13.7 smart card interface description....................................................................................... 374 13.7.1 sample connection ............................................................................................... 374 13.7.2 data format (except in bl ock transfer mode) .................................................... 374 13.7.3 block transfer mode ............................................................................................ 376 13.7.4 receive data sampling timing and receptio n margin ........................................ 377 13.7.5 initializatio n .......................................................................................................... 378 13.7.6 serial data transmission (excep t in block transfer mode) ................................ 379 13.7.7 serial data reception (except in block transfer mode) ..................................... 382 13.7.8 clock output control............................................................................................ 384 13.8 interrupt sources.............................................................................................................. .. 386 13.8.1 interrupts in normal serial co mmunication interface mode ............................... 386 13.8.2 interrupts in smart ca rd interface mode .............................................................. 387 13.9 usage notes .................................................................................................................... ... 388 13.9.1 module stop mode setting ................................................................................... 388 13.9.2 break detection an d processing ........................................................................... 388 13.9.3 mark state and br eak sending.............................................................................. 388 13.9.4 receive error flags and transmit operations (clock synchronous mode only) ......................................................................... 388 13.9.5 relation between writing to tdr and tdre flag .............................................. 388 13.9.6 restrictions on using dtc................................................................................... 389 13.9.7 sci operations during mode trans itions ............................................................. 390 13.9.8 notes on switching from sck pins to port pins .................................................. 394 section 14 crc operation circuit (crc).........................................................397 14.1 features....................................................................................................................... ....... 397 14.2 register desc riptions ......................................................................................................... 3 98 14.2.1 crc control regist er (crc cr) .......................................................................... 398 14.2.2 crc data input regist er (crcdir).................................................................... 399 14.2.3 crc data output regi ster (crcdor)................................................................ 399 14.3 crc operation circu it operatio n...................................................................................... 399 14.4 note on crc opera tion circuit......................................................................................... 403 section 15 serial communication interface with fifo (scif) ........................405 15.1 features....................................................................................................................... ....... 405 15.2 input/output pins .............................................................................................................. .407 15.3 register desc riptions ......................................................................................................... 4 08 15.3.1 receive shift regi ster (frs r) ............................................................................. 409 15.3.2 receive buffer regi ster (frb r) .......................................................................... 409
rev. 1.00 mar. 17, 2008 page xviii of xl 15.3.3 transmitter shift re gister (ftsr)........................................................................ 409 15.3.4 transmitter holding re gister (fthr).................................................................. 410 15.3.5 divisor latch h, l (fdlh, fdll) ...................................................................... 410 15.3.6 interrupt enable re gister (fier).......................................................................... 411 15.3.7 interrupt identification register (f iir) ................................................................ 412 15.3.8 fifo control regi ster (ffcr)............................................................................. 414 15.3.9 line control regi ster (fl cr) .............................................................................. 415 15.3.10 modem control regi ster (fm cr)........................................................................ 416 15.3.11 line status regi ster (flsr)................................................................................. 418 15.3.12 modem status regi ster (fms r)........................................................................... 422 15.3.13 scratch pad regist er (fscr)................................................................................ 422 15.3.14 scif control regist er (scifcr) ......................................................................... 423 15.4 operation ...................................................................................................................... ..... 425 15.4.1 baud ra te ............................................................................................................. 425 15.4.2 operation in asynchrono us communi cation........................................................ 426 15.4.3 initialization of the scif ...................................................................................... 427 15.4.4 data transmission/reception with flow control................................................. 430 15.4.5 data transmission/reception th rough the lpc interface ................................... 436 15.5 interrupt sources.............................................................................................................. .. 438 15.6 usage note..................................................................................................................... .... 438 15.6.1 power-down mode when lclk is selected for sclk ...................................... 438 section 16 serial pin multiplexed modes ......................................................... 439 16.1 features....................................................................................................................... ....... 439 16.2 input/output pins.............................................................................................................. .440 16.3 register desc riptions......................................................................................................... 4 41 16.3.1 serial multiplexed mode register 0 (smr0) ....................................................... 441 16.3.2 serial multiplexed mode register 1 (smr1) ....................................................... 442 16.4 operation of serial pi n multiplexed modes ...................................................................... 443 16.4.1 serial pin multiplexed mode 0 (default; smr0 register [bits sm 2, sm1, sm0] = [0 0 0])................................. 443 16.4.2 serial pin multiplexed mode 1 (smr0 register [bits sm2, sm 1, sm0] = [0 0 1])............................................... 444 16.4.3 serial pin multiplexed mode 2 (smr0 register [bits sm2, sm 1, sm0] = [0 1 0])............................................... 445 16.4.4 serial pin multiplexed mode 3 (smr0 register [bits sm2, sm 1, sm0] = [0 1 1])............................................... 446 16.4.5 serial pin multiplexed mode 4 (smr0 register [bits sm2, sm 1, sm0] = [1 0 0])............................................... 447 16.5 serial port pin co nfiguratio n............................................................................................. 448 section 17 i 2 c bus interface (iic)..................................................................... 449 17.1 features....................................................................................................................... ....... 449 17.2 input/output pins.............................................................................................................. .452
rev. 1.00 mar. 17, 2008 page xix of xl 17.3 register desc riptions ......................................................................................................... 4 53 17.3.1 i 2 c bus data regist er (icdr) .............................................................................. 453 17.3.2 slave address regi ster (sar).............................................................................. 454 17.3.3 second slave address register (sarx) .............................................................. 455 17.3.4 i 2 c bus mode regist er (icmr)............................................................................ 457 17.3.5 i 2 c bus transfer rate select register (iicx3)..................................................... 459 17.3.6 i 2 c bus control regi ster (icc r).......................................................................... 462 17.3.7 i 2 c bus status regi ster (icsr)............................................................................. 471 17.3.8 i 2 c bus extended control register (ic xr).......................................................... 475 17.3.9 i 2 c smbus control regi ster (ics mbcr)............................................................ 479 17.4 operation ...................................................................................................................... ..... 481 17.4.1 i 2 c bus data format ............................................................................................. 481 17.4.2 initializatio n .......................................................................................................... 483 17.4.3 master transmit operation ................................................................................... 483 17.4.4 master receive operation..................................................................................... 487 17.4.5 slave receive op eration....................................................................................... 496 17.4.6 slave transmit op eration ..................................................................................... 504 17.4.7 iric setting timing an d scl control ................................................................. 507 17.4.8 operation using the dtc ..................................................................................... 510 17.4.9 noise can celer...................................................................................................... 512 17.4.10 initialization of inte rnal stat e ............................................................................... 512 17.5 interrupt source ............................................................................................................... .. 514 17.6 usage notes .................................................................................................................... ... 515 section 18 lpc interface (lpc) ........................................................................529 18.1 features....................................................................................................................... ....... 529 18.2 input/output pins .............................................................................................................. .532 18.3 register desc riptions ......................................................................................................... 5 33 18.3.1 host interface control registers 0 and 1 (hicr0 and hicr1)............................ 535 18.3.2 host interface control registers 2 and 3 (hicr2 and hicr3)............................ 543 18.3.3 host interface control re gister 4 (hicr4) .......................................................... 546 18.3.4 host interface control re gister 5 (hicr5) .......................................................... 547 18.3.5 pin function control re gister (pinfncr) .......................................................... 548 18.3.6 lpc channel 1, 2 address register h, l (ladr12h, ladr12l)..................... 548 18.3.7 lpc channel 3 address register h, l (ladr3h, ladr3l)............................. 550 18.3.8 input data registers 1 to 3 (idr1 to idr3) ......................................................... 553 18.3.9 output data registers 0 to 3 (odr1 to odr3) ................................................... 553 18.3.10 bidirectional data registers 0 to 15 (twr0 to twr15) ..................................... 554 18.3.11 status registers 1 to 3 (str1 to str3) ............................................................... 555 18.3.12 serirq control regist er 0 (sirqcr0).............................................................. 563 18.3.13 serirq control regist er 1 (sirqcr1).............................................................. 567 18.3.14 serirq control regist er 2 (sirqcr2).............................................................. 571 18.3.15 serirq control regist er 3 (sirqcr3).............................................................. 572 18.3.16 serirq control regist er 4 (sirqcr4).............................................................. 573
rev. 1.00 mar. 17, 2008 page xx of xl 18.3.17 serirq control regist er 5 (sirqcr5).............................................................. 574 18.3.18 host interface select register (hisel)................................................................ 575 18.3.19 scif address register (s cifadrh, scifadrl) ............................................. 576 18.3.20 smic flag register (smicflg) ......................................................................... 577 18.3.21 smic control status re gister (smi ccsr).......................................................... 578 18.3.22 smic data register (smicdtr) ........................................................................ 578 18.3.23 smic interrupt regist er 0 (smicir0) ................................................................. 579 18.3.24 smic interrupt regist er 1 (smicir1) ................................................................. 581 18.3.25 bt status register 0 (btsr0 ).............................................................................. 582 18.3.26 bt status register 1 (btsr1 ).............................................................................. 585 18.3.27 bt control status regi ster 0 (btc sr0).............................................................. 588 18.3.28 bt control status regi ster 1 (btc sr1).............................................................. 589 18.3.29 bt control regist er (btcr)................................................................................ 591 18.3.30 bt data buffer (btdtr)..................................................................................... 594 18.3.31 bt interrupt mask re gister (btimsr)................................................................ 594 18.3.32 bt fifo valid size regi ster 0 (btfvsr0) ........................................................ 596 18.3.33 bt fifo valid size regi ster 1 (btfvsr1) ........................................................ 596 18.4 operation ...................................................................................................................... ..... 597 18.4.1 lpc interface ac tivation ...................................................................................... 597 18.4.2 lpc i/o cy cles..................................................................................................... 597 18.4.3 smic mode tran sfer flow................................................................................... 599 18.4.4 bt mode transf er flow ....................................................................................... 602 18.4.5 gate a2 0............................................................................................................... 604 18.4.6 lpc interface shutdown function (lpcpd)........................................................ 607 18.4.7 lpc interface serialized interr upt operation (serirq) ..................................... 611 18.4.8 lpc interface clock start reque st ....................................................................... 613 18.4.9 scif control from lpc interface......................................................................... 613 18.5 interrupt sources.............................................................................................................. .. 614 18.5.1 ibfi1, ibfi2, ibfi 3, and er ri ............................................................................ 614 18.5.2 smi, hirq1, hirq3, hirq4, hirq5, hirq6, hirq7, hirq8, hirq9, hirq10, hirq11, hirq 12, hirq13, hirq14 , and hirq15 ........................... 615 18.6 usage note..................................................................................................................... .... 618 18.6.1 data conf lict......................................................................................................... 618 section 19 a/d converter ................................................................................. 621 19.1 features....................................................................................................................... ....... 621 19.2 input/output pins.............................................................................................................. .623 19.3 register desc riptions......................................................................................................... 6 24 19.3.1 a/d data registers a to h (addra to addrh) .............................................. 624 19.3.2 a/d control/status regi ster (adcsr) ................................................................ 625 19.3.3 a/d control regist er (adcr) ............................................................................. 627 19.4 operation ...................................................................................................................... ..... 628 19.4.1 single mode.......................................................................................................... 628 19.4.2 scan mode ............................................................................................................ 629
rev. 1.00 mar. 17, 2008 page xxi of xl 19.4.3 input sampling and a/d conversion time .......................................................... 631 19.4.4 timing of external trigger input.......................................................................... 634 19.5 interrupt source ............................................................................................................... .. 635 19.6 a/d conversion accura cy definitions .............................................................................. 635 19.7 usage notes .................................................................................................................... ... 637 19.7.1 setting of module stop mode............................................................................... 637 19.7.2 permissible signal s ource impedance .................................................................. 637 19.7.3 influences on abso lute accuracy ......................................................................... 638 19.7.4 setting range of analog powe r supply and other pins ....................................... 638 19.7.5 notes on boar d design ......................................................................................... 638 19.7.6 notes on noise co untermeasures ......................................................................... 639 19.7.7 note on the usage in so ftware standb y mode ..................................................... 640 section 20 ram ................................................................................................641 section 21 flash memory ..................................................................................643 21.1 features....................................................................................................................... ....... 643 21.1.1 operating mode .................................................................................................... 645 21.1.2 mode comparison................................................................................................. 646 21.1.3 flash memory mat co nfiguratio n...................................................................... 647 21.1.4 block divi sion ...................................................................................................... 648 21.1.5 programming/erasing interface ............................................................................ 650 21.2 input/output pins .............................................................................................................. .652 21.3 register desc riptions ......................................................................................................... 6 52 21.3.1 programming/erasing in terface regi ster.............................................................. 654 21.3.2 programming/erasing inte rface parameter ........................................................... 662 21.4 on-board progra mming m ode .......................................................................................... 673 21.4.1 boot mode ............................................................................................................ 674 21.4.2 user program mode.............................................................................................. 678 21.4.3 user boot mode.................................................................................................... 689 21.4.4 procedure program and storable area for programming data ............................. 694 21.5 protection ..................................................................................................................... ...... 704 21.5.1 hardware protection ............................................................................................. 704 21.5.2 software prot ection............................................................................................... 706 21.5.3 error protec tion..................................................................................................... 706 21.6 switching between user mat and user boot mat ......................................................... 708 21.7 programmer mode ............................................................................................................. 709 21.8 serial communication interface sp ecification for b oot mode.......................................... 710 21.9 usage notes .................................................................................................................... ... 738 section 22 boundary scan (jtag) ...................................................................741 22.1 features....................................................................................................................... ....... 741 22.2 input/output pins .............................................................................................................. .743 22.3 register desc riptions ......................................................................................................... 7 44
rev. 1.00 mar. 17, 2008 page xxii of xl 22.3.1 instruction regist er (sdir) .................................................................................. 745 22.3.2 bypass register (sdbpr) .................................................................................... 746 22.3.3 boundary scan regist er (sdbsr) ....................................................................... 746 22.3.4 id code register (sdidr)................................................................................... 754 22.4 operation ...................................................................................................................... ..... 755 22.4.1 tap controller stat e transitio ns.......................................................................... 755 22.4.2 jtag rese t........................................................................................................... 756 22.5 boundary scan.................................................................................................................. .756 22.5.1 supported inst ructions .......................................................................................... 756 22.6 usage notes .................................................................................................................... ... 759 section 23 clock pulse generator..................................................................... 763 23.1 oscilla tor..................................................................................................................... ....... 764 23.1.1 connecting crystal resonato r .............................................................................. 764 23.1.2 external clock in put meth od ............................................................................... 765 23.2 pll multiplier circuit ....................................................................................................... 76 6 23.3 medium-speed cloc k divider ........................................................................................... 766 23.4 bus master clock se lect circuit........................................................................................ 766 23.5 subclock inpu t circui t ....................................................................................................... 76 6 23.6 subclock waveform sh aping circ uit ................................................................................ 766 23.7 clock select circuit ........................................................................................................... 767 23.8 usage notes .................................................................................................................... ... 768 23.8.1 note on resonator ................................................................................................ 768 23.8.2 notes on boar d design ......................................................................................... 768 23.8.3 note on operation check ..................................................................................... 768 section 24 power-down modes........................................................................ 769 24.1 register desc riptions......................................................................................................... 7 70 24.1.1 standby control regi ster (sby cr) ..................................................................... 770 24.1.2 low-power control re gister (l pwrcr) ............................................................ 772 24.1.3 module stop control registers h, l, and a (mstpcrh, mstpcrl , mstpcra) ................................................................ 774 24.1.4 sub-chip module stop control registers bh, bl (submstpbh, submstpbl)........................................................................... 776 24.2 mode transitions an d lsi stat es ....................................................................................... 777 24.3 medium-speed mode ........................................................................................................ 779 24.4 sleep mode ..................................................................................................................... ... 780 24.5 software sta ndby mode ..................................................................................................... 781 24.6 hardware stan dby mode ................................................................................................... 783 24.7 module stop mode ............................................................................................................ 784 24.8 usage notes .................................................................................................................... ... 784 24.8.1 i/o port st atus....................................................................................................... 784 24.8.2 current consumption when waiti ng for oscillation settling ............................... 784 24.8.3 dtc module st op mode ...................................................................................... 784
rev. 1.00 mar. 17, 2008 page xxiii of xl 24.8.4 notes on subclo ck usage ..................................................................................... 784 section 25 list of registers ...............................................................................785 25.1 register addresses (a ddress order).................................................................................. 786 25.2 register bits.................................................................................................................. ..... 796 25.3 register states in ea ch operating mode ........................................................................... 807 section 26 electrica l characteristics .................................................................817 26.1 absolute maximum ratings .............................................................................................. 817 26.2 dc charact eristics ............................................................................................................. 818 26.3 ac charact eristics ............................................................................................................. 822 26.3.1 clock timing ........................................................................................................ 822 26.3.2 control signal timing .......................................................................................... 827 26.3.3 bus timing ........................................................................................................... 829 26.3.4 multiplex bus timing........................................................................................... 839 26.3.5 timing of on-chip peri pheral modules ............................................................... 842 26.4 a/d conversion char acteristic s......................................................................................... 850 26.5 flash memory char acteristic s ........................................................................................... 851 26.6 usage notes .................................................................................................................... ... 852 appendix .........................................................................................................853 a. i/o port states in each processing state............................................................................ 853 b. product lineup................................................................................................................. .. 855 c. package dime nsions .......................................................................................................... 855 index .........................................................................................................857
rev. 1.00 mar. 17, 2008 page xxiv of xl
rev. 1.00 mar. 17, 2008 page xxv of xl figures section 1 overview figure 1.1 internal block diagram ............................................................................................ ..... 2 figure 1.2 pin assignment.................................................................................................... .......... 3 section 2 cpu figure 2.1 exception vector table (normal mode)..................................................................... 21 figure 2.2 stack structure in normal mode ................................................................................. 21 figure 2.3 exception vector table (advanced mode)................................................................. 22 figure 2.4 stack structure in advanced mode ............................................................................. 23 figure 2.5 memory map........................................................................................................ ....... 24 figure 2.6 cpu registers ..................................................................................................... ........ 25 figure 2.7 usage of general registers ........................................................................................ .26 figure 2.8 stack............................................................................................................. ............... 27 figure 2.9 general register data formats (1).............................................................................. 30 figure 2.9 general register data formats (2).............................................................................. 31 figure 2.10 memory data formats.............................................................................................. .32 figure 2.11 instruction formats (examples) ................................................................................ 44 figure 2.12 branch address specification in memory indirect mode ......................................... 48 figure 2.13 state transitions ................................................................................................ ........ 52 section 3 mcu operating modes figure 3.1 address map ....................................................................................................... ........ 61 section 4 exception handling figure 4.1 reset sequence.................................................................................................... ........ 67 figure 4.2 stack status after exception handling ........................................................................ 69 figure 4.3 operation when sp value is odd ............................................................................... 70 section 5 interrupt controller figure 5.1 block diagram of interrupt controller ........................................................................ 72 figure 5.2 block diagram of interrupts irq15 to irq0 .............................................................. 81 figure 5.3 block diagram of interrupt control operation ........................................................... 84 figure 5.4 flowchart of procedure up to inte rrupt acceptance in interrupt control mode 0....... 87 figure 5.5 state transition in interrupt control mode 1 .............................................................. 88 figure 5.6 flowchart of procedure up to inte rrupt acceptance in interrupt control mode 1..... 90 figure 5.7 interrupt exception handling ...................................................................................... 92 figure 5.8 interrupt control for dtc ......................................................................................... .. 94 figure 5.9 conflict between interrupt generation and disabling ................................................. 96
rev. 1.00 mar. 17, 2008 page xxvi of xl section 6 bus controller (bsc) figure 6.1 block diagram of bus controller.............................................................................. 101 figure 6.2 ios signal output timing ........................................................................................ 118 figure 6.3 access sizes and data alignment control (8-bit access space) .............................. 119 figure 6.4 access sizes and data alignment control (16-bit access space) ............................ 120 figure 6.5 bus timing for 8-bit, 2-state access space ............................................................. 123 figure 6.6 bus timing for 8-bit, 3-state access space ............................................................. 124 figure 6.7 bus timing for 16-bit, 2-state access space (even byte access)........................... 125 figure 6.8 bus timing for 16-bit, 2-state access space (odd byte access) ............................ 126 figure 6.9 bus timing for 16-bit, 2-state access space (word access) .................................. 127 figure 6.10 bus timing for 16-bit, 3-state access space (even byte access)......................... 128 figure 6.11 bus timing for 16-bit, 3-state access space (odd byte access) .......................... 129 figure 6.12 bus timing for 16-bit, 3-state access space (word access) ................................ 130 figure 6.13 glueless extension even byte access (admxe = 0)............................................ 131 figure 6.14 glueless extension odd byte access (admxe = 0) ............................................. 132 figure 6.15 glueless extension word access (admxe = 0) ................................................... 133 figure 6.16 bus timing for 8-bit, 2-state access space ........................................................... 134 figure 6.17 bus timing for 8-bit, 2-state access space ........................................................... 135 figure 6.18 bus timing for 8-bit, 3-state access space ........................................................... 135 figure 6.19 bus timing for 16-bit, 2-state access space (1) (even byte access) ................... 136 figure 6.20 bus timing for 16-bit, 2-state access space (2) (even byte access) ................... 137 figure 6.21 bus timing for 16-bit, 2-state access space (3) (odd byte access) .................... 137 figure 6.22 bus timing for 16-bit, 2-state access space (4) (odd byte access) .................... 138 figure 6.23 bus timing for 16-bit, 2-state access space (5) (word access)........................... 139 figure 6.24 bus timing for 16-bit, 2-state access space (6) (word access)........................... 139 figure 6.25 bus timing for 16-bit, 3-state access space (1) (even byte access) ................... 140 figure 6.26 bus timing for 16-bit, 3-state access space (2) (odd byte access) .................... 141 figure 6.27 bus timing for 16-bit, 3-state access space (3) (word access)........................... 141 figure 6.28 example of wait state insertion timing (pin wait mode) ..................................... 143 figure 6.29 example of wait state insertion timing................................................................. 145 figure 6.30 access timing example in burst rom space (ast = brsts1 = 1).................... 146 figure 6.31 access timing example in burst rom space (ast = brsts1 = 0).................... 147 figure 6.32 examples of idle cycle operation .......................................................................... 148 section 7 data transfer controller (dtc) figure 7.1 block diagram of dtc ............................................................................................. 1 52 figure 7.2 block diagram of dtc activation source control .................................................. 164 figure 7.3 dtc register information location in address space ............................................. 165 figure 7.4 dtc operation flowchart......................................................................................... 16 7 figure 7.5 memory mapping in normal mode .......................................................................... 168
rev. 1.00 mar. 17, 2008 page xxvii of xl figure 7.6 memory mapping in repeat mode ........................................................................... 169 figure 7.7 memory mapping in block transfer mode............................................................... 170 figure 7.8 chain transfer operation .......................................................................................... 171 figure 7.9 dtc operation timing (example in normal mode or repeat mode)...................... 172 figure 7.10 dtc operation timing (example of block transfer mode, with block size of 2)............................................................................................... 173 figure 7.11 dtc operation timing (example of chain transfer) ............................................ 173 section 8 i/o ports figure 8.1 noise canceler circuit ............................................................................................ .. 206 figure 8.2 noise canceler operation.......................................................................................... 207 section 9 14-bit pwm timer (pwmx) figure 9.1 pwmx (d/a) block diagram................................................................................... 255 figure 9.2 pwmx (d/a) operation ........................................................................................... 263 figure 9.3 output waveform (os = 0, dadr corresponds to t l ) ............................................ 266 figure 9.4 output waveform (os = 1, dadr corresponds to t h ) ............................................ 267 figure 9.5 d/a data register configuration when cfs = 1 ...................................................... 267 figure 9.6 output waveform when dadr = h'0207 (os = 1) ................................................. 268 section 10 16-bit free-running timer (frt) figure 10.1 block diagram of 16-bit free-running timer ....................................................... 272 figure 10.2 increment timing with internal clock source ........................................................ 279 figure 10.3 timing of output compare a output ..................................................................... 279 figure 10.4 clearing of frc by compare-match a signal ....................................................... 280 figure 10.5 timing of output compare flag (ocfa or ocfb) setting ................................... 280 figure 10.6 timing of overflow flag (ovf) setting................................................................. 281 figure 10.7 ocra automatic addition timing ........................................................................ 282 figure 10.8 conflict between frc write and clear................................................................... 283 figure 10.9 conflict between frc write and increment ........................................................... 284 figure 10.10 conflict between ocr write and compare-match (when automatic addition function is not used) ............................................... 285 figure 10.11 conflict between ocr write and compare-match (when automatic addition function is used) ...................................................... 286 section 11 8-bit timer (tmr) figure 11.1 block diagram of 8-bit timer (tmr_0 and tmr_1)............................................ 290 figure 11.2 block diagram of 8-bit timer (tmr_y and tmr_x) .......................................... 291 figure 11.3 count timing for internal clock input.................................................................... 302 figure 11.4 timing of cmf setting at compare-match ............................................................ 302 figure 11.5 timing of coun ter clear by compare-match ......................................................... 303 figure 11.6 timing of ovf flag setting.................................................................................... 303
rev. 1.00 mar. 17, 2008 page xxviii of xl figure 11.7 conflict between tcnt write and counter clear .................................................. 306 figure 11.8 conflict between tcnt write and increment ........................................................ 307 figure 11.9 conflict between tcor write and compare-match .............................................. 308 section 12 watchdog timer (wdt) figure 12.1 block diagram of wdt .......................................................................................... 312 figure 12.2 watchdog timer mode (rst/ nmi = 1) operation................................................. 319 figure 12.3 interval timer mode operation............................................................................... 320 figure 12.4 ovf flag set timing .............................................................................................. 320 figure 12.5 output timing of reso signal ............................................................................... 321 figure 12.6 writing to tcnt and tcsr (wdt_0)................................................................... 323 figure 12.7 conflict between tcnt write and increment ........................................................ 324 figure 12.8 sample circuit for resetting the system by the reso signal................................ 325 section 13 serial comm unication interface (sci) figure 13.1 block diagram of sci_1 and sci_3 ....................................................................... 329 figure 13.2 data format in asynchronous communication (example with 8-bit data, parity, two stop bits).................................................. 347 figure 13.3 receive data sampling timing in asynchronous mode ........................................ 349 figure 13.4 relation between output clock and transmit data phase (asynchronous mode) ............................................................................................. 350 figure 13.5 sample sci initialization flowchart ....................................................................... 351 figure 13.6 example of operation in transmission in asynchronous mode (example with 8-bit data, parity, one stop bit).................................................... 352 figure 13.7 sample serial transmission flowchart ................................................................... 353 figure 13.8 example of sci operation in reception (example with 8-bit data, parity, one stop bit).................................................... 354 figure 13.9 sample serial reception flowchart (1)................................................................... 356 figure 13.9 sample serial reception flowchart (2)................................................................... 357 figure 13.10 example of communication using multiprocessor format (transmission of data h'aa to receiving station a)........................................... 359 figure 13.11 sample multiprocessor serial transmission flowchart ........................................ 360 figure 13.12 example of sci operation in reception (example with 8-bit data, multiprocessor bit, one stop bit).............................. 362 figure 13.13 sample multiprocessor serial reception flowchart (1)........................................ 363 figure 13.13 sample multiprocessor serial reception flowchart (2)........................................ 364 figure 13.14 data format in synchronous communication (lsb-first)................................... 365 figure 13.15 sample sci initialization flowchart ..................................................................... 366 figure 13.16 sample sci transmission operation in clock synchronous mode...................... 368 figure 13.17 sample serial transmission flowchart ................................................................. 369 figure 13.18 example of sci receive operation in clock synchronous mode ........................ 370
rev. 1.00 mar. 17, 2008 page xxix of xl figure 13.19 sample serial reception flowchart ...................................................................... 371 figure 13.20 sample flowchart of simulta neous serial transmission and reception............... 373 figure 13.21 pin connection for smart card interface .............................................................. 374 figure 13.22 data formats in normal smart card interface mode............................................ 375 figure 13.23 direct convention (sdir = sinv = o/ e = 0) ...................................................... 375 figure 13.24 inverse convention (sdir = sinv = o/ e = 1)..................................................... 375 figure 13.25 receive data sampling timing in smart card interface mode (when clock frequency is 372 times the bit rate) ............................................. 378 figure 13.26 data re-transfer operation in sci transmission mode........................................ 380 figure 13.27 tend flag set timings during transmission ...................................................... 380 figure 13.28 sample transmission flowchart ........................................................................... 381 figure 13.29 data re-transfer operation in sci reception mode ............................................. 382 figure 13.30 sample reception flowchart................................................................................. 383 figure 13.31 clock output fixing timing ................................................................................. 384 figure 13.32 clock stop and restart procedure ......................................................................... 385 figure 13.33 sample transmission using dtc in clock synchronous mode ........................... 389 figure 13.34 sample flowchart for mode transition during transmission ............................... 391 figure 13.35 pin states during transmission in asynchronous mode (internal clock)............. 391 figure 13.36 pin states during transmission in clock synchronous mode (internal clock) .... 392 figure 13.37 sample flowchart fo r mode transition during reception .................................... 393 figure 13.38 switching from sck pins to port pins .................................................................. 394 figure 13.39 prevention of low pulse output at switching from sck pins to port pins.......... 395 section 14 crc operation circuit (crc) figure 14.1 block diagram of crc operation circuit .............................................................. 397 figure 14.2 lsb-first data transmission .................................................................................. 399 figure 14.3 msb-first data transmission ................................................................................. 400 figure 14.4 lsb-first data reception ....................................................................................... 40 1 figure 14.5 msb-first data reception ...................................................................................... 402 figure 14.6 lsb-first and msb-first transmit data ................................................................ 403 section 15 serial communicat ion interface with fifo (scif) figure 15.1 block diagram of scif........................................................................................... 4 06 figure 15.2 data format in serial transmission/reception (example with 8-bit data, parity and 2 stop bits).................................................. 426 figure 15.3 example of initialization flowchart ........................................................................ 427 figure 15.4 example of data transmission flowchart .............................................................. 428 figure 15.5 example of data reception flowchart.................................................................... 429 figure 15.6 example of initialization flowchart ........................................................................ 430 figure 15.7 example of data transmission/reception standby flowchart ............................... 431 figure 15.8 example of data transmission flowchart .............................................................. 432
rev. 1.00 mar. 17, 2008 page xxx of xl figure 15.9 example of data transmission suspension flowchart ........................................... 433 figure 15.10 example of data reception flowchart.................................................................. 434 figure 15.11 example of data reception suspension flowchart............................................... 435 section 16 serial pin multiplexed modes figure 16.1 serial pin multiplexed mode 0................................................................................ 443 figure 16.2 serial pin multiplexed mode 1................................................................................ 444 figure 16.3 serial pin multiplexed mode 2................................................................................ 445 figure 16.4 serial pin multiplexed mode 3................................................................................ 446 figure 16.5 serial pin multiplexed mode 4................................................................................ 447 section 17 i 2 c bus interface (iic) figure 17.1 block diagram of i 2 c bus interface........................................................................ 450 figure 17.2 i 2 c bus interface connections (example: this lsi as master) .............................. 451 figure 17.3 i 2 c bus data formats (i 2 c bus formats)................................................................ 481 figure 17.4 i 2 c bus data formats (serial formats) ................................................................... 481 figure 17.5 i 2 c bus ti ming........................................................................................................ 482 figure 17.6 sample flowchart for iic initialization................................................................... 483 figure 17.7 sample flowchart for operations in master transmit mode .................................. 484 figure 17.8 operation timing example in master transmit mode (mls = wait = 0)........... 486 figure 17.9 stop condition issuance operation timing example in master transmit mode (mls = wait = 0)................................................................................................. 487 figure 17.10 sample flowchart for operations in master receive mode (hnds = 1)............. 488 figure 17.11 master receive mode operation timing example (mls = wait = 0, hnds = 1) ............................................................................ 490 figure 17.12 stop condition issuance timing example in master receive mode (mls = wait = 0, hnds = 1) ............................................................................ 490 figure 17.13 sample flowchart for operations in master receive mode (receiving multiple bytes) (wait = 1).................................................................. 491 figure 17.14 sample flowchart for operations in master receive mode (receiving a single byte) (wait = 1) .................................................................... 492 figure 17.15 master receive mode operation timing example (mls = ackb = 0, wait = 1)............................................................................ 495 figure 17.16 stop condition issuance timing example in master receive mode (mls = ackb = 0, wait = 1)............................................................................ 495 figure 17.17 sample flowchart for opera tions in slave receive mode (hnds = 1) ............... 497 figure 17.18 slave receive mode operation timing example (1) (mls = 0, hnds= 1)........ 499 figure 17.19 slave receive mode operation timing example (2) (mls = 0, hnds= 1)........ 499 figure 17.20 sample flowchart for opera tions in slave receive mode (hnds = 0) ............... 500 figure 17.21 slave receive mode operation timing example (1) (mls = ackb = 0, hnds = 0) ........................................................................... 502
rev. 1.00 mar. 17, 2008 page xxxi of xl figure 17.22 slave receive mode operation timing example (2) (mls = ackb = 0, hnds = 0) .......................................................................... 503 figure 17.23 sample flowchart for slave transmit mode......................................................... 504 figure 17.24 slave transmit mode operation timing example (mls = 0).............................. 506 figure 17.25 iric setting timing and scl control (1) ............................................................ 507 figure 17.26 iric setting timing and scl control (2) ............................................................ 508 figure 17.27 iric setting timing and scl control (3) ............................................................ 509 figure 17.28 block diagram of noise canceler......................................................................... 512 figure 17.29 notes on reading master receive data ................................................................ 520 figure 17.30 flowchart for start condition issuance instruction for retransmission and timing ................................................................................................................... 521 figure 17.31 stop condition issuance timing ........................................................................... 522 figure 17.32 iric flag clearing timing when wait = 1 ....................................................... 523 figure 17.33 icdr register read and iccr register access timing in slave transmit mode ............................................................................................ 524 figure 17.34 trs bit set timing in slave mode....................................................................... 525 figure 17.35 diagram of erroneous operation when arbitration lost ...................................... 527 section 18 lpc interface (lpc) figure 18.1 block diagram of lpc............................................................................................ 5 31 figure 18.2 typical lframe timing....................................................................................... 599 figure 18.3 abort mechanism .................................................................................................. .. 599 figure 18.4 smic write transfer flow ..................................................................................... 600 figure 18.5 smic read transfer flow ...................................................................................... 601 figure 18.6 bt write transfer flow .......................................................................................... 6 02 figure 18.7 bt read transfer flow........................................................................................... 6 03 figure 18.8 ga20 output ...................................................................................................... ..... 605 figure 18.9 power-down state termination timing ................................................................. 610 figure 18.10 serirq timing ................................................................................................... . 611 figure 18.11 clock start request timing .................................................................................. 613 figure 18.12 hirq flowchart (example of channel 1)............................................................. 617 section 19 a/d converter figure 19.1 block diagram of the a/d converter...................................................................... 622 figure 19.2 example of a/d converter operation (when channel 1 is selected in single mode) ........................................................ 629 figure 19.3 example of a/d converter operation (when channels an0 to an3 are selected in scan mode) .................................... 630 figure 19.4 a/d conversion timing .......................................................................................... 63 2 figure 19.5 timing of external trigger input ............................................................................ 634 figure 19.6 a/d conversion accuracy definitions.................................................................... 636
rev. 1.00 mar. 17, 2008 page xxxii of xl figure 19.7 a/d conversion accuracy definitions.................................................................... 636 figure 19.8 example of analog input circuit ............................................................................ 637 figure 19.9 example of analog input protection circuit ........................................................... 639 figure 19.10 analog input pin equivalent circuit ..................................................................... 640 section 21 flash memory figure 21.1 block diagram of flash memory............................................................................ 644 figure 21.2 mode transition of flash memory.......................................................................... 645 figure 21.3 flash memory configuration .................................................................................. 647 figure 21.4 block division of user mat .................................................................................. 649 figure 21.5 overview of user procedure program..................................................................... 650 figure 21.6 system configuration in boot mode....................................................................... 674 figure 21.7 automatic-bit-rate adjustment operation of sci ................................................. 675 figure 21.8 overview of boot mode state transition diagram................................................. 677 figure 21.9 programming/e rasing overview flow.................................................................... 678 figure 21.10 ram map when programming/erasing is executed ........................................... 679 figure 21.11 progra mming procedure........................................................................................ 680 figure 21.12 erasing procedure............................................................................................... ... 685 figure 21.13 repeating procedure of erasing and programming............................................... 687 figure 21.14 procedure for programming user mat in user boot mode ................................ 690 figure 21.15 procedure for erasing user mat in user boot mode .......................................... 692 figure 21.16 transitions to error-protection state..................................................................... 707 figure 21.17 switching between the user mat and user boot mat....................................... 708 figure 21.18 boot program states............................................................................................. . 711 figure 21.19 bit-rate-adjustment sequence ............................................................................. 712 figure 21.20 communication protocol format .......................................................................... 713 figure 21.21 new bit-rate selection sequence......................................................................... 724 figure 21.22 prog ramming sequence......................................................................................... 728 figure 21.23 erasure sequence ................................................................................................ .. 731 section 22 boundary scan (jtag) figure 22.1 jtag block diagram.............................................................................................. 7 42 figure 22.2 tap controller state transitions ............................................................................ 755 figure 22.3 reset signal circuit without reset signal interference.......................................... 759 figure 22.4 serial data input/output (1).................................................................................... 7 60 figure 22.5 serial data input/output (2).................................................................................... 7 61 section 23 clock pulse generator figure 23.1 block diagram of clock pulse generator ............................................................... 763 figure 23.2 typical connection to crystal resonator................................................................ 764 figure 23.3 equivalent circuit of crystal resonator.................................................................. 764 figure 23.4 example of external clock input ............................................................................ 765
rev. 1.00 mar. 17, 2008 page xxxiii of xl figure 23.5 note on board design of oscillation circuit section............................................... 768 section 24 power-down modes figure 24.1 mode transition diagram ....................................................................................... 777 figure 24.2 medium-s peed mode timing ................................................................................. 780 figure 24.3 software standby mode application example ....................................................... 782 figure 24.4 hardware standby mode timing ............................................................................ 783 section 26 electrical characteristics figure 26.1 darlington transistor drive circuit (example)....................................................... 821 figure 26.2 led drive circuit (example) ................................................................................. 822 figure 26.3 output load circuit.............................................................................................. ... 822 figure 26.4 system clock timing .............................................................................................. 824 figure 26.5 oscillation stabilization timing.............................................................................. 824 figure 26.6 oscillation stabilization ti ming (exiting software standby mode)....................... 825 figure 26.7 external clock input timing................................................................................... 825 figure 26.8 timing of external cl ock output stabilization delay time ................................... 826 figure 26.9 subclock input timing ............................................................................................ 826 figure 26.10 reset input timing .............................................................................................. .. 827 figure 26.11 interrupt input timing.......................................................................................... . 828 figure 26.12 basic bus timing/2-state access.......................................................................... 831 figure 26.13 basic bus timing/3-state access.......................................................................... 832 figure 26.14 basic bus timing/3-state access with one wait state ........................................ 833 figure 26.15 even byte access (admxe = 0).......................................................................... 834 figure 26.16 odd byte access (admxe = 0)........................................................................... 835 figure 26.17 word access (admxe = 0) ................................................................................. 836 figure 26.18 burst rom access timing/2-state access........................................................... 837 figure 26.19 burst rom access timing/1-state access........................................................... 838 figure 26.20 multiplex bus timing/data 2-state access .......................................................... 840 figure 26.21 multiplex bus timing/data 3-state access .......................................................... 841 figure 26.22 i/o port input/output timing................................................................................ 843 figure 26.23 pwmx output timing.......................................................................................... 843 figure 26.24 sck clock input timing....................................................................................... 843 figure 26.25 sci input/output timing (clock synchronous mode) ......................................... 843 figure 26.26 a/d converter external trigger input timing...................................................... 844 figure 26.27 wdt output timing ( reso ) ............................................................................... 844 figure 26.28 i 2 c bus interface input/output timing ................................................................. 846 figure 26.29 lpc interface (lpc) timing................................................................................. 847 figure 26.30 jtag etck timing ............................................................................................. 848 figure 26.31 reset hold timing ............................................................................................... . 849 figure 26.32 jtag input/output timing................................................................................... 849
rev. 1.00 mar. 17, 2008 page xxxiv of xl figure 26.33 connecting capacitors to vcc and vcl pins...................................................... 852 appendix figure c.1 package dimensions (tqfp-144) ............................................................................ 855
rev. 1.00 mar. 17, 2008 page xxxv of xl tables section 1 overview table 1.1 pin assignment in each operating mode ...................................................................... 4 table 1.2 pin functions................................................................................................................ 10 section 2 cpu table 2.1 instruction classification ............................................................................................. 33 table 2.2 operation notation....................................................................................................... 34 table 2.3 data transfer instructions............................................................................................ 35 table 2.4 arithmetic operations instructions (1)......................................................................... 36 table 2.4 arithmetic operations instructions (2)......................................................................... 37 table 2.5 logic operations instructions ...................................................................................... 38 table 2.6 shift instru ctions .......................................................................................................... 38 table 2.7 bit manipulation instructions (1)................................................................................. 39 table 2.7 bit manipulation instructions (2)................................................................................. 40 table 2.8 branch instructions ...................................................................................................... 41 table 2.9 system control instructions ......................................................................................... 42 table 2.10 block data transfer instructions ............................................................................... 43 table 2.11 addressing modes...................................................................................................... 45 table 2.12 absolute address access ranges .............................................................................. 47 table 2.13 effective address calculation (1) .............................................................................. 49 table 2.13 effective address calculation (2) .............................................................................. 50 section 3 mcu operating modes table 3.1 mcu operating mode selection.................................................................................. 55 section 4 exception handling table 4.1 exception types and priority....................................................................................... 63 table 4.2 exception handling vector table................................................................................ 64 table 4.3 status of ccr after trap instruction exception handling........................................... 68 section 5 interrupt controller table 5.1 pin configuration ......................................................................................................... 72 table 5.2 correspondence between interrupt source and icr .................................................... 74 table 5.3 interrupt sources, vector addresse s, and interrupt priorities...................................... 82 table 5.4 interrupt control modes............................................................................................... 84 table 5.5 interrupts selected in each interrupt control mode .................................................... 85 table 5.6 operations and control signal functions in each interrupt control mode ................. 86 table 5.7 interrupt res ponse times ............................................................................................ 93 table 5.8 number of states in interrupt handling routine execution status.............................. 93
rev. 1.00 mar. 17, 2008 page xxxvi of xl table 5.9 interrupt source selection and clearing control ......................................................... 95 section 6 bus controller (bsc) table 6.1 pin configuration....................................................................................................... 102 table 6.2 address ranges and external address spaces........................................................... 111 table 6.3 bit settings and bus specificatio ns of basic bus interface ....................................... 112 table 6.4 bus specifications for basic extended area/basic bus interface ............................. 112 table 6.5 bus specifications for 256-kbyte extended area/basic bus interface ..................... 113 table 6.6 address-data multiplex address spaces ................................................................... 115 table 6.7 bit settings and bus specificatio ns of basic bus interface ....................................... 116 table 6.8 bus specifications for ios extended area/multiplex bus interface (address cy cle) ......................................................................................................... 116 table 6.9 bus specifications for ios extended area/multiplex bus interface (data cycle)............................................................................................................... 116 table 6.10 bus specifications for 256-kbyte extended area/multiplex bus interface (address cy cle)........................................................................................................ 117 table 6.11 bus specifications for 256-kbyte extended area/multiplex bus interface (data cycle) ............................................................................................................. 117 table 6.12 address range for ios signal output ..................................................................... 118 table 6.13 data buses used and valid strobes......................................................................... 121 table 6.14 data buses used and valid strobes (gluless extension) ........................................ 122 table 6.15 pin states in idle cycle ............................................................................................ 149 section 7 data transfer controller (dtc) table 7.1 correspondence between interrupt sources and dtcer .......................................... 157 table 7.2 dtc event counter conditions ................................................................................. 161 table 7.3 flag status/address code .......................................................................................... 162 table 7.4 interrupt sources, dtc vector addresses, and corresponding dtces.................... 166 table 7.5 register functions in normal mode .......................................................................... 168 table 7.6 register functions in repeat mode ........................................................................... 169 table 7.7 register functions in block transfer mode .............................................................. 170 table 7.8 dtc execution status................................................................................................ 174 table 7.9 number of states required for each execution status.............................................. 174 section 8 i/o ports table 8.1 port functions ............................................................................................................ 180 table 8.2 port 1 input pull-up mos states............................................................................... 186 table 8.3 port 2 input pull-up mos states............................................................................... 190 table 8.4 port 3 input pull-up mos states............................................................................... 193 table 8.5 port 6 input pull-up mos states............................................................................... 210 table 8.6 input pull-up mos states ......................................................................................... 230 table 8.7 port d input pull- up mos states .............................................................................. 243
rev. 1.00 mar. 17, 2008 page xxxvii of xl section 9 14-bit pwm timer (pwmx) table 9.1 pin configuration ....................................................................................................... 256 table 9.2 clock select of pwmx_1 and pwmx_0.................................................................. 261 table 9.3 settings and operation (examples when = 34 mhz).............................................. 264 table 9.4 locations of additional pulses added to base pulse (when cfs = 1) ..................... 269 section 10 16-bit free-running timer (frt) table 10.1 frt interrupt sources.............................................................................................. 282 table 10.2 switching of internal clock and frc operation ..................................................... 287 section 11 8-bit timer (tmr) table 11.1 (1) clock input to tcnt and count condition (tmr_0) ....................................... 295 table 11.1 (2) clock input to tcnt and count condition (tmr_1) ....................................... 296 table 11.1 (3) clock input to tcnt and count condition (tmr_x, tmr_y)....................... 296 table 11.2 registers accessible by tmr_x/tmr_y............................................................... 301 table 11.3 interrupt sources of 8-bit timers tmr_0, tmr_1, tmr_y, and tmr_x........... 305 table 11.4 switching of internal clocks and tcnt operation................................................. 309 section 12 watchdog timer (wdt) table 12.1 pin configuration ..................................................................................................... 313 table 12.2 wdt interrupt source.............................................................................................. 322 section 13 serial comm unication interface (sci) table 13.1 pin configuration ..................................................................................................... 330 table 13.2 relationships between n setting in brr and bit rate b ........................................ 343 table 13.3 examples of brr settings for various bit rates (asynchronous mode) ............... 344 table 13.4 maximum bit rate for each frequency (asynchronous mode).............................. 344 table 13.5 maximum bit rate with external clock input (asynchronous mode).................... 344 table 13.6 brr settings for various bit rates (clock synchronous mode)............................ 345 table 13.7 maximum bit rate with external clock input (clock synchronous mode) ........... 346 table 13.8 brr settings for various bit rates (smart card interface mode, n = 0, s = 372) ........................................................... 346 table 13.9 maximum bit rate for each frequency (smart card interface mode, s = 372) ..... 346 table 13.10 serial transfer formats (asynchronous mode) ..................................................... 348 table 13.11 ssr status flags and r eceive data handling ....................................................... 355 table 13.12 sci interrupt sources ............................................................................................. 386 table 13.13 sci interrupt sources ............................................................................................. 387 section 15 serial communicat ion interface with fifo (scif) table 15.1 pin configuration ..................................................................................................... 407 table 15.2 register access ........................................................................................................ 408 table 15.3 interrupt control function ....................................................................................... 413 table 15.4 scif output setting................................................................................................. 424
rev. 1.00 mar. 17, 2008 page xxxviii of xl table 15.5 example of baud rate settings................................................................................ 425 table 15.6 correspondence between lpc interface i/o address and the scif registers ....... 436 table 15.7 register states.......................................................................................................... 437 table 15.8 interrupt sources ...................................................................................................... 438 table 15.9 interrupt source, vector address, and interrupt priority ......................................... 438 section 16 serial pin multiplexed modes table 16.1 pin configuration..................................................................................................... 440 section 17 i 2 c bus interface (iic) table 17.1 pin configuration..................................................................................................... 452 table 17.2 transfer format........................................................................................................ 456 table 17.3 i 2 c bus transfer rate (1) ......................................................................................... 460 table 17.3 i 2 c bus transfer rate (2) ......................................................................................... 461 table 17.4 flags and transfer states (master mode) ................................................................ 468 table 17.5 flags and transfer states (slave mode)................................................................... 469 table 17.6 output data hold time............................................................................................ 480 table 17.7 iscmbcr setting.................................................................................................... 480 table 17.8 i 2 c bus data format symbols ................................................................................. 482 table 17.9 examples of operation using the dtc ................................................................... 511 table 17.10 iic interrupt source ............................................................................................... 514 table 17.11 i 2 c bus timing (scl and sda outputs) .............................................................. 515 table 17.12 permissible scl rise time (t sr ) values................................................................. 516 table 17.13 i 2 c bus timing (with maximum influence of t sr /t sf ) ............................................. 518 section 18 lpc interface (lpc) table 18.1 pin configuration..................................................................................................... 532 table 18.2 ladr1, ladr2 initial values ............................................................................... 548 table 18.3 host register selection............................................................................................ 549 table 18.4 slave selection inte rnal registers............................................................................ 549 table 18.5 lpc i/o cycle.......................................................................................................... 598 table 18.6 ga20 setting/clearing timing ................................................................................ 604 table 18.7 fast gate a20 output signals.................................................................................. 606 table 18.8 scope of lpc interface pin shutdown..................................................................... 608 table 18.9 scope of initialization in each lpc interface mode................................................ 609 table 18.10 serialized interrupt transfer cycle frame configuration...................................... 612 table 18.11 receive complete interrupts and error interrupt................................................... 614 table 18.12 hirq setting and clearing conditions when lpc channels are used ................. 616 table 18.13 hirq setting and clearing conditions when scif channels are used ................ 617 table 18.14 host address example........................................................................................... 619
rev. 1.00 mar. 17, 2008 page xxxix of xl section 19 a/d converter table 19.1 pin configuration ..................................................................................................... 623 table 19.2 analog input channels and corresponding addr registers ................................. 625 table 19.3 a/d conversion characteristics (single mode)....................................................... 633 table 19.4 a/d conversion characteristics (scan mode) ......................................................... 633 table 19.5 a/d converter interrupt source ............................................................................... 635 table 19.6 standard of analog pins........................................................................................... 640 section 21 flash memory table 21.1 comparison of prog ramming m odes ....................................................................... 646 table 21.2 pin configuration ..................................................................................................... 652 table 21.3 register/parameter and target mode....................................................................... 653 table 21.4 parameters and target modes .................................................................................. 663 table 21.5 setting on-board programming mode .................................................................... 673 table 21.6 system clock frequency for automatic-bit-rate adjustment by this lsi ............ 675 table 21.7 executable mat ...................................................................................................... 695 table 21.8 (1) useable area for programming in user program mode..................................... 696 table 21.8 (2) useable area for erasure in user program mode .............................................. 698 table 21.8 (3) useable area for programming in user boot mode .......................................... 700 table 21.8 (4) useable area for erasure in user boot mode .................................................... 702 table 21.9 hardware protection................................................................................................. 705 table 21.10 software protection................................................................................................ 706 table 21.11 inquiry and selection commands .......................................................................... 714 table 21.12 programming/erasing command ........................................................................... 727 table 21.13 status code ............................................................................................................ 736 table 21.14 error c ode.............................................................................................................. 737 section 22 boundary scan (jtag) table 22.1 pin configuration.................................................................................................. 743 table 22.2 jtag register serial transfer.............................................................................. 744 table 22.3 correspondence between pins and boundary scan register ................................ 747 section 23 clock pulse generator table 23.1 damping resistance values ................................................................................. 764 table 23.2 crystal resonator parameters ............................................................................... 765 table 23.3 ranges of multiplied clock frequency ................................................................ 766 section 24 power-down modes table 24.1 operating frequency and wait time ....................................................................... 772 table 24.2 lsi internal states in each mode ............................................................................ 778
rev. 1.00 mar. 17, 2008 page xl of xl section 26 electrical characteristics table 26.1 absolute maximum ratings .................................................................................... 817 table 26.2 dc characteristics (1).............................................................................................. 818 table 26.2 dc characteristics (2).............................................................................................. 819 table 26.3 permissible output currents .................................................................................... 821 table 26.4 clock timing ........................................................................................................... 823 table 26.5 external clock input conditions.............................................................................. 823 table 26.6 subclock input conditions....................................................................................... 824 table 26.7 control signal timing ............................................................................................. 827 table 26.8 bus timi ng............................................................................................................... 830 table 26.9 multiplex bus timing .............................................................................................. 839 table 26.10 timing of on-chip peripheral modules ................................................................ 842 table 26.11 i 2 c bus ti ming ...................................................................................................... 845 table 26.12 lpc module timing .............................................................................................. 846 table 26.13 jtag timing ......................................................................................................... 848 table 26.14 a/d conversion characteristics (an7 to an0 input: 80/160- state conversion) ..................................................... 850 table 26.15 flash memory characteristics................................................................................ 851 appendix table a.1 i/o port states in each processing state............................................................... 853
section 1 overview rev. 1.00 mar. 17, 2008 page 1 of 862 rej09b0429-0100 section 1 overview 1.1 overview ? high-speed h8s/2600 central processing unit with an internal 16-bit architecture upward-compatible with h8/300 and h8/300h cpus on an object level sixteen 16-bit general registers 69 basic instructions multiplication and accumulation instructions ? various peripheral functions data transfer controller (dtc) 14-bit pwm timer (pwmx) 16-bit free-running timer (frt) 8-bit timer (tmr) watchdog timer (wdt) asynchronous or synchronous serial communication interface (sci) crc operation circuit (crc) serial communication interface with fifo (scif) i 2 c bus interface (iic) lpc interface (lpc) 10-bit a/d converter boundary scan (jtag) clock pulse generator ? on-chip memory rom type model rom ram remarks flash memory version R4F2164 512 kbytes 40 kbytes
section 1 overview rev. 1.00 mar. 17, 2008 page 2 of 862 rej09b0429-0100 ? reprograming count: 1000 times (typ.) ? general i/o ports i/o pins: 107 input-only pins: 9 ? supports various power-down states ? compact package package (code) body size pin pitch ptqp0144lc-a 16.0 16.0 mm 0.4 mm 1.2 block diagram rom ( flash) 512k (+16k ub) evc h8s/2600 cpu dtc clock pulse generator ram 40k lpc 14-bit pwm 4 wdt 2 port 1 port 2 port 3 port 4 port 5 port 6 port 7 port e port f port d port c port b port a p ort 9 p ort 8 a/d converter tmr interru pt contro ller jt ag sci_1, sci_3 scif frt c rc cal culator iic_0 to iic_5 [legend] cpu: central processing unit dtc: data transfer controller evc: event counter sci: serial communication interface scif: serial communication interface with fifo frt: 16-bit free running timer iic: i 2 c bus interface lpc: lpc interface wdt: watchdog timer jtag: boundary scan tmr: 8-bit timer bus contro ller figure 1.1 internal block diagram
section 1 overview rev. 1.00 mar. 17, 2008 page 3 of 862 rej09b0429-0100 1.3 pin description 1.3.1 pin assignment 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 vcc p45/ irq5 /rs5/hc5 p46/ irq6 /rs6/hc6 p47/ irq7 /rs7/hc7 p56/i rq14 /pwx0 p57/i rq15 /pwx1 vss res md1 md0 nmi stby vcl md2 p51/ irq9 /rxdf p50/ irq8 /txdf p97/ cs256 / wait p96/excl/phi p95/ as / ios p94/ hwr / wr p93/ rd p92/ hbe p91/ ah p90/ lwr / lbe pc7/pwx3 pc6/pwx2 pc5/sda4 pc4/scl4 pc3/sda3 pc2/scl3 pc1/sda2 pc0/scl2 pa7/event7/a23 pa6/event6/a22 pa5/event5/a21 vcc p13/a3/ad3 p14/a4/ad4 p15/a5/ad5 p16/a6/ad6 p17/a7/ad7 p20/a8/ad8 p21/a9/ad9 p22/a10/ad10 p23/a11/ad11 p24/a12/ad12 p25/a13/ad13 p26/a14/ad14 p27/a15/ad15 vss pf0/rs8 pf1/rs9 pf2/rs10 etrst etck etdi etdo etms vcc p67/db15/d7 p66/db14/d6 p65/db13/d5/ rt s p64db12/d4/ cts p63/db11/d3 p62/db10/d2 p61/db9/d1 p60/db8/d0 avref avcc p77/ exirq7 /an7 p76/ exirq6 /an6 p75/ exirq5 /an5 p74/ exirq4/ an4 p73/ exirq3/ an3 p72/ exirq2 /an2 p71/ exirq1 /an1 p70/ exirq0 /an0 avss pd0/lsci pd1/ lsmi pd2/ pme pd3/ga20 pd4/ clkrun pd5/ lpcpd pd6/scl5 pd7/sda5 pe0/lad0 pe1/lad1 pe2/lad2 pe3/lad3 pe4/ lframe pe5/ lreset pe6/lclk pe7/serirq p80/ exirq8 /scl0 p81/ exirq9 /sda0 p82/ exirq10 /scl1 p83/ exirq11 /sda1 p84/ exirq12 /sck3 p85/ exirq13 /sck1 p86/ exirq14 p87/ exirq15 / adtr g vss pa0/event0/a16 pa1/event1/a17 pa2/event2/a18 pa3/event3/a19 pa4/event4/a20 p12/a2/ad2 p11/a1/ad1 vss p10/a0/ad0 pb7/event15 pb6/event14 pb5/event13 pb4/event12 pb3/event11 pb2/event10 pb1/event9 pb0/event8 p30/d8 p31/d9 p32/d10 p33/d11 p34/d12 p35/d13 p36/d14 p37d15 p40/ irq0 /rs0/hc0 p41/ irq1/ rs1/hc1 p42 /irq2/ rs2/hc2 p43/ irq3 /rs3/hc3 p52/ irq10 /txd1 p53/ irq11 /rxd1 fwe p54/ irq12 /txd3 p55/ irq13 /rxd3 p44/ irq4 /rs4/dhc4 vss nc pf3/rs11 reso xtal extal h8s/2164 group ptqp0144lc-a (top view) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 figure 1.2 pin assignment
section 1 overview rev. 1.00 mar. 17, 2008 page 4 of 862 rej09b0429-0100 1.3.2 pin assignment in each operating mode table 1.1 pin assignment in each operating mode pin no. pin name tqfp-144 extended mode (expe = 1) single-chip mode (expe = 0) flash memory programmer mode 1 vcc vcc vcc 2 p45/ irq5 /rs5/hc5 p45/ irq5 /rs5/hc5 nc 3 p46/ irq6 /rs6/hc6 p46/ irq6 /rs6/hc6 nc 4 p47/ irq7 /rs7/hc7 p47/ irq7 /rs7/hc7 nc 5 p56/ irq14 /pwx0 p56/ irq14 /pwx0 nc 6 p57/ irq15 /pwx1 p57/ irq15 /pwx1 nc 7 vss vss vss 8 res res res 9 md1 md1 vss 10 md0 md0 vss 11 nmi nmi fa9 12 stby stby vcc 13 vcl vcl vcl 14 md2 md2 vcc 15 p51/ irq9 /rxdf p51/ irq9 /rxdf fa17 16 p50/ irq8 /txdf p50/ irq8 /txdf nc 17 p97/ cs256 / wait p97 vcc 18 p96/excl/phi p96 nc 19 as / ios p95 fa16 20 p94/ hwr / wr p94 fa15 21 p93/ rd p93 we 22 p92/ hbe p92 vss 23 p91/ ah p91 vcc 24 p90 /lwr / lbe p90 vcc 25 pc7/pwx3 pc7/pwx3 nc 26 pc6/pwx2 pc6/pwx2 nc
section 1 overview rev. 1.00 mar. 17, 2008 page 5 of 862 rej09b0429-0100 pin no. pin name tqfp-144 extended mode (expe = 1) single-chip mode (expe = 0) flash memory programmer mode 27 pc5/sda4 pc5/sda4 nc 28 pc4/scl4 pc4/scl4 nc 29 pc3/sda3 pc3/sda3 nc 30 pc2/scl3 pc2/scl3 nc 31 pc1/sda2 pc1/sda2 nc 32 pc0/scl2 pc0/scl2 nc 33 pa7/event7/a23 pa7/event7 nc 34 pa6/event6/a22 pa6/event6 nc 35 pa5/event5/a21 pa5/event5 nc 36 vcc vcc vcc 37 pa4/event4/a20 pa4/event4 nc 38 pa3/event3/a19 pa3/event3 nc 39 pa2/event2/a18 pa2/event2 nc 40 pa1/event1/a17 pa1/event1 nc 41 pa0/event0/a16 pa0/event0 nc 42 vss vss vss 43 p87/ exirq15 / adtrg p87/ exirq15 / adtrg nc 44 p86/ exirq14 p86/ exirq14 nc 45 p85/ exirq13 /sck1 p85/ exirq13 /sck1 nc 46 p84/ exirq12 /sck3 p84/ exirq12 /sck3 nc 47 p83/ exirq11 /sda1 p83/ exirq11 /sda1 nc 48 p82/ exirq10 /scl1 p82/ exirq10 /scl1 nc 49 p81/ exirq9 /sda0 p81/ exirq9 /sda0 nc 50 p80/ exirq8 /scl0 p80/ exirq8 /scl0 nc 51 pe7/serirq pe7/serirq nc 52 pe6/lclk pe6/lclk nc 53 pe5/ lreset pe5/ lreset nc 54 pe4/ lframe pe4/ lframe nc 55 pe3/lad3 pe3/lad3 nc
section 1 overview rev. 1.00 mar. 17, 2008 page 6 of 862 rej09b0429-0100 pin no. pin name tqfp-144 extended mode (expe = 1) single-chip mode (expe = 0) flash memory programmer mode 56 pe2/lad2 pe2/lad2 nc 57 pe1/lad1 pe1/lad1 nc 58 pe0/lad0 pe0/lad0 nc 59 pd7/sda5 pd7/sda5 nc 60 pd6/scl5 pd6/scl5 nc 61 pd5/ lpcpd pd5/ lpcpd nc 62 pd4/ clkrun pd4/ clkrun nc 63 pd3/ga20 pd3/ga20 nc 64 pd2/ pme pd2/ pme nc 65 pd1/ lsmi pd1/ lsmi nc 66 pd0/lsci pd0/lsci nc 67 avss avss vss 68 p70/ exirq0 /an0 p70/ exirq0 /an0 nc 69 p71/ exirq1 /an1 p71/ exirq1 /an1 nc 70 p72/ exirq2 /an2 p72/ exirq2 /an2 nc 71 p73/ exirq3 /an3 p73/ exirq3 /an3 nc 72 p74/ exirq4 /an4 p74/ exirq4 /an4 nc 73 p75/ exirq5 /an5 p75/ exirq5 /an5 nc 74 p76/ exirq6 /an6 p76/ exirq6 /an6 nc 75 p77/ exirq7 /an7 p77/ exirq7 /an7 nc 76 avcc avcc vcc 77 avref avref vcc 78 p60/db8/d0 p60/db8 nc 79 p61/db9/d1 p61/db9 nc 80 p62/db10/d2 p62/db10 nc 81 p63/db11/d3 p63/db11 nc 82 p64/db12/ cts /d4 p64/db12/ cts nc 83 p65/db13/ rts /d5 p65/db13/ rts nc 84 p66/db14/d6 p66/db14 nc
section 1 overview rev. 1.00 mar. 17, 2008 page 7 of 862 rej09b0429-0100 pin no. pin name tqfp-144 extended mode (expe = 1) single-chip mode (expe = 0) flash memory programmer mode 85 p67/db15/d7 p67/db15 vss 86 vcc vcc vcc 87 etms etms nc 88 etdo etdo nc 89 etdi etdi nc 90 etck etck nc 91 etrst etrst res 92 pf2/rs10 pf2/rs10 nc 93 pf1/rs9 pf1/rs9 nc 94 pf0/rs8 pf0/rs8 nc 95 vss vss vss 96 p27/a15/ad15 p27 ce 97 p26/a14/ad14 p26 fa14 98 p25/a13/ad13 p25 fa13 99 p24/a12/ad12 p24 fa12 100 p23/a11/ad11 p23 fa11 101 p22/a10/ad10 p22 fa10 102 p21/a9/ad9 p21 oe 103 p20/a8/ad8 p20 fa8 104 p17/a7/ad7 p17 fa7 105 p16/a6/ad6 p16 fa6 106 p15/a5/ad5 p15 fa5 107 p14/a4/ad4 p14 fa4 108 p13/a3/ad3 p13 fa3 109 p12/a2/ad2 p12 fa2 110 p11/a1/ad1 p11 fa1 111 vss vss vss 112 p10/a0/ad0 p10 fa0 113 pb7/event15 pb7/event15 nc
section 1 overview rev. 1.00 mar. 17, 2008 page 8 of 862 rej09b0429-0100 pin no. pin name tqfp-144 extended mode (expe = 1) single-chip mode (expe = 0) flash memory programmer mode 114 pb6/event14 pb6/event14 nc 115 pb5/event13 pb5/event13 nc 116 pb4/event12 pb4/event12 nc 117 pb3/event11 pb3/event11 nc 118 pb2/event10 pb2/event10 nc 119 pb1/event9 pb1/event9 nc 120 pb0/event8 pb0/event8 nc 121 p30/d8 p30 fo0 122 p31/d9 p31 fo1 123 p32/d10 p32 fo2 124 p33/d11 p33 fo3 125 p34/d12 p34 fo4 126 p35/d13 p35 fo5 127 p36/d14 p36 fo6 128 p37/d15 p37 fo7 129 p40/ irq0 /rs0/hc0 p40/ irq0 /rs0/hc0 nc 130 p41/ irq1 /rs1/hc1 p41/ irq1 /rs1/hc1 nc 131 p42/ irq2 /rs2/hc2 p42/ irq2 /rs2/hc2 nc 132 p43/ irq3 /rs3/hc3 p43/ irq3 /rs3/hc3 nc 133 p52/ irq10 /txd1 p52/ irq10 /txd1 fa18 134 p53/ irq11 /rxd1 p53/ irq11 /rxd1 fa19 135 fwe fwe fwe 136 p54/ irq12 /txd3 p54/ irq12 /txd3 nc 137 p55/ irq13 /rxd3 p55/ irq13 /rxd3 nc 138 p44/ irq4 /rs4/hc4 p44/ irq4 /rs4/hc4 nc 139 vss vss vss 140 nc nc nc 141 pf3/rs11 pf3/rs11 nc 142 reso reso nc
section 1 overview rev. 1.00 mar. 17, 2008 page 9 of 862 rej09b0429-0100 pin no. pin name tqfp-144 extended mode (expe = 1) single-chip mode (expe = 0) flash memory programmer mode 143 xtal xtal xtal 144 extal extal extal
section 1 overview rev. 1.00 mar. 17, 2008 page 10 of 862 rej09b0429-0100 1.3.3 pin functions table 1.2 pin functions type symbol pin no. i/o name and function vcc 1, 36, 86 input power supply pins. connect all these pins to the system power supply. connect the bypass capacitor between vcc and vss (near vcc). vcl 13 input external capacitance pin for internal step- down power. connect this pin to vss through an external capacitor (that is located near this pin) to stabilize internal step-down power. power supply vss 7, 42, 95, 111, 139 input ground pins. connect all these pins to the system power supply (0v). xtal 143 input extal 144 input for connection to a crystal resonator. an external clock can be supplied from the extal pin. for an example of crystal resonator connection, see section 23, clock pulse generator. 18 output supplies the system clock to external devices. clock excl 18 input 32.768-khz external clock for sub clock should be supplied. operating mode control md2 md1 md0 14 9 10 input these pins set the operating mode. inputs at these pins should not be changed during operation. res 8 input reset pin. when this pin is low, the chip is reset. reso 142 output outputs a reset signal to an external device. stby 12 input when this pin is low, a transition is made to hardware standby mode. system control fwe 135 input pin for use by flash memory.
section 1 overview rev. 1.00 mar. 17, 2008 page 11 of 862 rej09b0429-0100 type symbol pin no. i/o name and function a23 to a16 33 to 35, 37 to 41 address bus a15 to a0 96 to 110, 112 output address output pins d15 to d8 128 to 121 upper 8 bits of bidirectional bus data bus d7 to d0 85 to 78 input/ output lower 8 bits of bidirectional bus ad15 to ad8 96 to 103 8 bit bus or upper 8 bits of 16-bit bus address-data multiplex bus ad7 to ad0 104 to 110, 112 input/ output lower 8 bits of 16-bit bus nmi 11 input nonmaskable interrupt request input pin irq15 , irq14 , irq13 , irq12 , irq11 , irq10 , irq9 , irq8 , irq7 to irq5 , irq4 , irq3 to irq0 6, 5, 137, 136, 134, 133, 15, 16 4 to 2 138 132 to 129 interrupts exirq15 to exirq12 , exirq11 to exirq8 , exirq7 to exirq5 , exirq4 to exirq0 43 to 50, 75 to 68, 6, 5 input these pins are used to request maskable interrupts. either irqn or exirqn can be selected as the irqn interrupt signal input pin.
section 1 overview rev. 1.00 mar. 17, 2008 page 12 of 862 rej09b0429-0100 type symbol pin no. i/o name and function wait 17 input requests wait state insertion to bus cycles when an external tri-state address space is accessed. rd 21 output low level on this pin indicates that the mcu is reading from an external address space. hwr 20 output low level on this pin indicates that the mcu is writing to an external address space. the upper byte of the data bus is valid. lwr 24 output low level on this pin indicates that the mcu is writing to an external address space. the lower byte of the data bus is valid. as / ios 19 output low level on this pin indicates that the address output on the address bus is valid. cs256 17 output indicates access to the 256-kbyte area of h?f80000 to h'fbffff. wr 20 output low level on this pin indicates that the mcu is writing to an external address space. hbe 22 output low level on this pin indicates that the mcu is accessing an external address space. the upper byte of the data bus is valid. lbe 24 output low level on this pin indicates that the mcu is accessing an external address space. the lower byte of the data bus is valid. bus control ah 23 output address latch signal for the address-data multiplex bus etrst 91 input etms 87 input etdo 88 output etdi 89 input boundary scan etck 90 input boundary scan interface pins
section 1 overview rev. 1.00 mar. 17, 2008 page 13 of 862 rej09b0429-0100 type symbol pin no. i/o name and function 14-bit pwm timer (pwmx) pwx0 to pwx3 5, 6, 26, 25 output pwm d/a pulse output pins txd1, txd3 133, 136 output transmit data output pins rxd1, rxd3 134, 137 input receive data input pins serial communi- cation interface (sci_1 and sci_3) sck1, sck3 45, 46 input/ output clock input/output pins. txdf 16 output transmit data output pin rxdf 15 input receive data input pin cts 82 input transmit grant input pin serial communi- cation interface with fifo (scif) rts 83 output transmit request output pin scl0, scl1, scl2, scl3, scl4, scl5 50, 48 32, 30 28, 60 input/ output iic clock input/output pins. these pins can drive a bus directly with the nmos open drain output. i 2 c bus interface (iic) sda0, sda1, sda2, sda3, sda4, sda5 49, 47 31, 29 27, 59 input/ output iic data input/output pins. these pins can drive a bus directly with the nmos open drain output. an7 to an0 75 to 68 input analog input pins avcc 76 input analog power supply pins. when the a/d converter is not used, these pins should be connected to the system power supply (+3.3 v). avref 77 input analog reference voltage input pin. when the a/d converter is not used, this pin should be connected to the system power supply (+3.3 v). avss 67 input analog ground pin. this pin should be connected to the system power supply (0 v). a/d converter adtrg 43 input external trigger input pin to start a/d conversion
section 1 overview rev. 1.00 mar. 17, 2008 page 14 of 862 rej09b0429-0100 type symbol pin no. i/o name and function lad3 to lad0 55 to 58 input/ output transfer cycle type/address/data i/o pins lframe 54 input input pin indicating transfer cycle start and forced termination lreset 53 input lpc reset pin. when this pin is low, a reset state is entered. lclk 52 input pci clock input pin serirq 51 input/ output lpc serialized host interrupt request signal lsci, lsmi , pme 66, 65, 64 input/ output lpc auxiliary output. their functions are general i/o port. ga20 63 input/ output gate a20 control signal output pin; also used as the input pin for monitoring the output state. clkrun 62 input/ output input/output pin used to request starting the lclk operation while lclk is stopped. lpc interface (lpc) lpcpd 61 input input pin used to control shutdown of the lcp module event counter event15 to event8, event7 to event5, event4 to event0 113 to 120, 33 to 35, 37 to 41 input event counter input pins retain state output pins rs11, rs10 to rs8, rs7 to rs5, rs4, rs3 to rs0 141, 92 to 94, 4 to 2, 138, 132 to 129 output the outputs on these pins are only initialized by a system reset. debounced input pins db15 to db8 85 to 78 input pins with noise eliminating functions. large current output pins hc7 to hc5, hc4, hc3 to hc0 4 to 2, 138, 132 to 129 output these pins can be used to drive leds or for other purposes where large currents are required.
section 1 overview rev. 1.00 mar. 17, 2008 page 15 of 862 rej09b0429-0100 type symbol pin no. i/o name and function p17 to p11 p10 104 to 110, 112 input/ output 8-bit input/output pins p27 to p20 96 to 103 input/ output 8-bit input/output pins p37 to p30 128 to 121 input/ output 8-bit input/output pins p47 to p45 p44 p43 to p40 4 to 2, 138, 132 to 129 input/ output 8-bit input/output pins p57, p56 p55, p54 p53, p52 p51, p50 6, 5, 137, 136, 134, 133, 15, 16 input/ output 8-bit input/output pins p67 to p60 85 to 78 input/ output 8-bit input/output pins p77 to p70 75 to 68 input 8-bit input pins p87 to p80 43 to 50 input/ output 8-bit input/output pins p97 to p90 17 to 24 input/ output 8-bit input/output pins pa7 to pa5, pa4 to pa0 33 to 35 37 to 41 input/ output 8-bit input/output pins pb7 to pb0 113 to 120 input/ output 8-bit input/output pins pc7 to pc0 25 to 32 input/ output 8-bit input/output pins pd7 to pd0 59 to 66 input/ output 8-bit input/output pins pe7 to pe0 51 to 58 input/ output 8-bit input/output pins i/o ports pf3, pf2 to pf0 141, 92 to 94 input/ output 4-bit input/output pins
section 1 overview rev. 1.00 mar. 17, 2008 page 16 of 862 rej09b0429-0100
section 2 cpu rev. 1.00 mar. 17, 2008 page 17 of 862 rej09b0429-0100 section 2 cpu the h8s/2600 cpu is a high-speed central processing unit with an internal 32-bit architecture that is upward-compatible with the h8/300 and h8/300h cpus. the h8s/2600 cpu has sixteen 16-bit general registers, can address a 16-mbyte linear ad dress space, and is ideal for realtime control. this section describes the h8s/2600 cpu. the us able modes and address spaces differ depending on the product. for details on each product, refer to section 3, mcu operating modes. 2.1 features ? upward-compatible with h8/300 and h8/300h cpus ? can execute h8/300 and h8/300h cpus object programs ? general-register architecture ? sixteen 16-bit general registers also usable as sixteen 8-bit registers or eight 32-bit registers ? sixty-nine basic instructions ? 8/16/32-bit arithmetic and logic instructions ? multiply and divide instructions ? powerful bit-manipulation instructions ? multiply-and-accumulate instruction ? eight addressing modes ? register direct [rn] ? register indirect [@ern] ? register indirect with displacemen t [@(d:16,ern) or @(d:32,ern)] ? register indirect with post-increment or pre-decrement [@ern+ or @?ern] ? absolute address [@aa:8, @aa:16, @aa:24, or @aa:32] ? immediate [#xx:8, #xx:16, or #xx:32] ? program-counter relative [@(d:8,pc) or @(d:16,pc)] ? memory indirect [@@aa:8] ? 16-mbyte address space ? program: 16 mbytes ? data: 16 mbytes ? high-speed operation ? all frequently-used instructions execute in one or two states ? 8/16/32-bit register-register add/subtract: 1 state ? 8 8-bit register-register multiply: 2 states
section 2 cpu rev. 1.00 mar. 17, 2008 page 18 of 862 rej09b0429-0100 ? 16 8-bit register-register divide: 12 states ? 16 16-bit register-register multiply: 3 states ? 32 16-bit register-register divide: 20 states ? two cpu operating modes ? normal mode* ? advanced mode ? power-down state ? transition to power-down st ate by the sleep instruction ? cpu clock speed selection note: * normal mode is not available in this lsi. 2.1.1 differences between h8s/2600 cpu and h8s/2000 cpu the differences between the h8s/2600 cpu and the h8s/2000 cpu are shown below. ? register configuration the mac register is supported by the h8s/2600 cpu only. ? basic instructions the four instructions mac, clrmac, ldmac, and stmac are supported by the h8s/2600 cpu only. ? the number of execution states of the mulxu and mulxs instructions; execution states instruction mnemonic h8s/2600 h8s/2000 mulxu.b rs, rd 2 * 12 mulxu mulxu.w rs, erd 2 * 20 mulxs.b rs, rd 3 * 13 mulxs mulxs.w rs, erd 3 * 21 clrmac clrmac 1 * ldmac ers,mach 1 * ldmac ldmac ers,macl 1 * stmac mach,erd 1 * stmac stmac macl,erd 1 * not supported note: * this becomes one state greater immediately after a mac instruction. in addition, there are differences in address space, ccr and exr register functions, and power-down modes, etc., depending on the model.
section 2 cpu rev. 1.00 mar. 17, 2008 page 19 of 862 rej09b0429-0100 2.1.2 differences from h8/300 cpu in comparison to the h8/300 cpu, the h8s/2600 cpu has the following enhancements: ? more general registers and control registers ? eight 16-bit extended registers, and one 8-bit and two 32-bit control registers, have been added. ? expanded address space ? normal mode supports the same 64-kbyt e address space as the h8/300 cpu. ? advanced mode supports a maximum 16-mbyte address space. ? enhanced addressing ? the addressing modes have been enhanced to make effective use of the 16-mbyte address space. ? enhanced instructions ? addressing modes of bit-manipulation instructions have been enhanced. ? signed multiply and divide instructions have been added. ? a multiply-and-accumulate instruction has been added. ? two-bit shift instructions have been added. ? instructions for saving and restoring multiple registers have been added. ? a test and set instruction has been added. ? higher speed ? basic instructions execute twice as fast. 2.1.3 differences from h8/300h cpu in comparison to the h8/300h cpu, the h8s/2600 cpu has the following enhancements: ? more control registers ? one 8-bit and two 32-bit control registers have been added. ? enhanced instructions ? addressing modes of bit-manipulation instructions have been enhanced. ? a multiply-and-accumulate instruction has been added. ? two-bit shift instructions have been added. ? instructions for saving and restoring multiple registers have been added. ? a test and set instruction has been added. ? higher speed ? basic instructions execute twice as fast.
section 2 cpu rev. 1.00 mar. 17, 2008 page 20 of 862 rej09b0429-0100 2.2 cpu operating modes the h8s/2600 cpu has two operating modes: norma l and advanced. normal mode supports a maximum 64-kbyte address space. advanced mode supports a maximum 16-mbyte total address space. the mode is selected by the mode pins. 2.2.1 normal mode the exception vector table and stack have th e same structure as in the h8/300 cpu. ? address space linear access to a 64-kbyte maximum address space is provided. ? extended registers (en) the extended registers (e0 to e7) can be used as 16-bit registers, or as the upper 16-bit segments of 32-bit registers. when en is used as a 16-bit register it can contain any value, even when the corresponding general register (rn) is used as an address register. if the general register is referenced in the register indirect addressing mode with pre-decrement (@?rn) or post-increment (@rn+) and a carry or borrow o ccurs, however, the value in the corresponding extended register (en) will be affected. ? instruction set all instructions and addressing modes can be used. only the lower 16 bits of effective addresses (ea) are valid. ? exception vector table and memory indirect branch addresses in normal mode the top area starting at h'0000 is allocated to the excep tion vector table. one branch address is stored per 16 bits. the exception vector table structure in normal mode is shown in figure 2.1. for details of the exception vector table, see section 4, exception handling. the memory indirect addressing mode (@@aa:8) employed in the jmp and jsr instructions uses an 8-bit absolute address included in the instruction code to specify a memory operand that contains a branch address. in normal mode the operand is a 16-bit word operand, providing a 16-bit branch address. branch addresses can be stored in the area from h'0000 to h'00ff. note that the first part of this range is also used for the exception vector table. ? stack structure when the program counter (pc) is pushed onto the stack in a subroutine call, and the pc, condition-code register (ccr), and extended control register (exr) are pushed onto the stack in exception handling, they are stored as shown in figure 2.2. exr is not pushed onto the stack in interrupt control mode 0. for details, see section 4, exception handling. note: normal mode is not available in this lsi.
section 2 cpu rev. 1.00 mar. 17, 2008 page 21 of 862 rej09b0429-0100 h'0000 h'0001 h'0002 h'0003 h'0004 h'0005 h'0006 h'0007 h'0008 h'0009 h'000a h'000b exception vector 1 exception vector 2 exception vector 3 exception vector 5 exception vector 6 exception vector table exception vector 4 figure 2.1 exception v ector table (normal mode) pc (16 bits) exr * 1 reserved * 1 , * 3 ccr ccr * 3 pc (16 bits) sp sp (sp * 2 1. when exr is not used it is not stored on the stack. 2. sp when exr is not used. 3. lgnored when returning. notes: (b) exception handling (a) subroutine branch ) figure 2.2 stack stru cture in normal mode
section 2 cpu rev. 1.00 mar. 17, 2008 page 22 of 862 rej09b0429-0100 2.2.2 advanced mode ? address space linear access to a 16-mbyte maxi mum address space is provided. ? extended registers (en) the extended registers (e0 to e7) can be used as 16-bit registers, or as the upper 16-bit segments of 32-bit registers or address registers. ? instruction set all instructions and addressing modes can be used. ? exception vector table and memory indirect branch addresses in advanced mode, the top area starting at h'00000000 is allocated to the exception vector table in units of 32 bits. in each 32 bits, the upper 8 bits are ignored and a branch address is stored in the lower 24 bits (figure 2.3). for details of the exception vector table, see section 4, exception handling. h'00000000 h'00000003 h'00000004 h'0000000b h'0000000c h'00000010 h'00000008 h'00000007 reserved reserved reserved reserved reserved exception vector 1 exception vector 2 exception vector 3 exception vector 4 exception vector table exception vector 5 figure 2.3 excep tion vector tabl e (advanced mode)
section 2 cpu rev. 1.00 mar. 17, 2008 page 23 of 862 rej09b0429-0100 the memory indirect addressing mode (@@aa:8) employed in the jmp and jsr instructions uses an 8-bit absolute address included in the instruction code to specify a memory operand that contains a branch address. in advanced mode the operand is a 32-bit longword operand, providing a 32-bit branch address. the upper 8 bits of these 32 bits is a reserved area that is regarded as h'00. branch addresses can be stored in the area from h'00000000 to h'000000ff. note that the first part of this range is also used for the exception vector table. ? stack structure in advanced mode, when the program counter (pc) is pushed onto the stack in a subroutine call, and the pc, condition-code register (ccr), and extended control register (exr) are pushed onto the stack in exception handling, they are stored as shown in figure 2.4. when exr is not pushed onto the stack in interrupt control mode 0. for details, see section 4, exception handling. pc (24 bits) exr * 1 reserved * 1 , * 3 ccr pc (24 bits) sp sp (sp * 2 reserved (a) subroutine branch (b) exception handling notes: 1. when exr is not used it is not stored on the stack. 2. sp when exr is not used. 3. ignored when returning. ) figure 2.4 stack stru cture in advanced mode
section 2 cpu rev. 1.00 mar. 17, 2008 page 24 of 862 rej09b0429-0100 2.3 address space figure 2.5 shows a memory map for the h8s/2600 cpu. the h8s/2600 cpu provides linear access to a maximum 64-kbyte address space in normal mode, and a maximum 16-mbyte (architecturally 4-gbyte) address space in adva nced mode. the usable modes and address spaces differ depending on the product. for details on each product, refer to section 3, mcu operating modes. h'0000 h'ffff h'00000000 h'ffffffff h'00ffffff 64-kbyte 16-mbyte cannot be used in this lsi program area data area (b) advanced mode (a) normal mode figure 2.5 memory map
section 2 cpu rev. 1.00 mar. 17, 2008 page 25 of 862 rej09b0429-0100 2.4 registers the h8s/2600 cpu has the internal registers shown in figure 2.6. there are two types of registers; general registers and control registers. the control registers are a 24-bit program counter (pc), an 8-bit extended control register (exr), an 8-bit condition code register (ccr), and a 64-bit multiply-accumulate register (mac). ti2i1i0 exr 76543210 pc mach macl mac 23 63 32 41 31 0 0 15 0 7 0 7 0 e0 e1 e2 e3 e4 e5 e6 e7 r0h r1h r2h r3h r4h r5h r6h r7h r0l r1l r2l r3l r4l r5l r6l r7l sp: pc: exr: t: i2 to i0: ccr: i: ui: stack pointer program counter extended control register trace bit interrupt mask bits condition-code register interrupt mask bit user bit or interrupt mask bit half-carry flag user bit negative flag zero flag overflow flag carry flag multiply-accumulate register er0 er1 er2 er3 er4 er5 er6 er7 (sp) iuihunzvc ccr 76543210 h: u: n: z: v: c: mac: general registers (rn) and extended registers (en) control registers (cr) [legend] sign extension ---- figure 2.6 cpu registers
section 2 cpu rev. 1.00 mar. 17, 2008 page 26 of 862 rej09b0429-0100 2.4.1 general registers the h8s/2600 cpu has eight 32-bit general register s. these general registers are all functionally identical and can be used as both address register s and data registers. when a general register is used as a data register, it can be accessed as a 32-b it, 16-bit, or 8-bit register. figure 2.7 illustrates the usage of the general registers. when the genera l registers are used as 32-bit registers or address registers, they are designated by the letters er (er0 to er7). the er registers divide into 16-bit general registers designated by the letters e (e0 to e7) and r (r0 to r7). these registers are functionally equivalent, providing a maximum of sixteen 16-bit registers. the e registers (e0 to e7) are also referred to as extended registers. the r registers divide into 8-bit general register s designated by the letters rh (r0h to r7h) and rl (r0l to r7l). these registers are functionally equivalent, providing a maximum of sixteen 8- bit registers. the usage of each register can be selected independently. general register er7 has the function of stack poi nter (sp) in addition to its general-register function, and is used implicitly in exception handling and subroutine calls. figure 2.8 shows the stack.  address registers  32-bit registers  16-bit registers  8-bit registers er registers (er0 to er7) e registers (extended registers) (e0 to e7) r registers (r0 to r7) rh registers (r0h to r7h) rl registers (r0l to r7l) figure 2.7 usage of general registers
section 2 cpu rev. 1.00 mar. 17, 2008 page 27 of 862 rej09b0429-0100 sp (er7) free area stack area figure 2.8 stack 2.4.2 program counter (pc) this 24-bit counter indicates the address of the next instruction the cpu will execute. the length of all cpu instructions is 2 bytes (one word), so the least significant pc bit is ignored. (when an instruction is fetched, the least si gnificant pc bit is regarded as 0). 2.4.3 extended control register (exr) exr is an 8-bit register that manipulates the ldc, stc, andc, orc, and xorc instructions. when these instructions, except for the stc instruction, are executed, all interrupts including nmi will be masked for three states after execution is completed. bit bit name initial value r/w description 7 t 0 r/w trace bit when this bit is set to 1, a trace exception is generated each time an instruction is executed. when this bit is cleared to 0, instructions are executed in sequence. 6 to 3 ? all 1 ? reserved these bits are always read as 1. 2 1 0 i2 i1 i0 1 1 1 r/w r/w r/w these bits designate the interrupt mask level (0 to 7). for details, refer to section 5, interrupt controller.
section 2 cpu rev. 1.00 mar. 17, 2008 page 28 of 862 rej09b0429-0100 2.4.4 condition-code register (ccr) this 8-bit register contains internal cpu status information, including an interrupt mask bit (i) and half-carry (h), negative (n), zero (z), overflow (v), and carry (c) flags. operations can be performed on the ccr bits by the ldc, stc, andc, orc, and xorc instructions. the n, z, v, and c flags are used as branching conditions for conditional branch (bcc) instructions. bit bit name initial value r/w description 7 i 1 r/w interrupt mask bit masks interrupts other than nmi when set to 1. nmi is accepted regardless of the i bit setting. the i bit is set to 1 at the start of an exception-handling sequence. for details, refer to section 5, interrupt controller. 6 ui undefined r/w user bit or interrupt mask bit can be read or written by software using the ldc, stc, andc, orc, and xorc instructions. this bit cannot be used as an interrupt mask bit in this lsi. 5 h undefined r/w half-carry flag when the add.b, addx.b, sub.b, subx.b, cmp.b, or neg.b instruction is executed, this flag is set to 1 if there is a carry or borrow at bit 3, and cleared to 0 otherwise. when the add.w, sub.w, cmp.w, or neg.w instruction is executed, the h flag is set to 1 if there is a carry or borrow at bit 11, and cleared to 0 otherwise. when the add.l, sub.l, cmp.l, or neg.l instruction is executed, the h flag is set to 1 if there is a carry or borrow at bit 27, and cleared to 0 otherwise. 4 u undefined r/w user bit can be read or written by software using the ldc, stc, andc, orc, and xorc instructions. 3 n undefined r/w negative flag stores the value of the most significant bit of data as a sign bit. 2 z undefined r/w zero flag set to 1 to indicate zero data, and cleared to 0 to indicate non-zero data.
section 2 cpu rev. 1.00 mar. 17, 2008 page 29 of 862 rej09b0429-0100 bit bit name initial value r/w description 1 v undefined r/w overflow flag set to 1 when an arithmetic overflow occurs, and cleared to 0 at other times. 0 c undefined r/w carry flag set to 1 when a carry occurs, and cleared to 0 otherwise. used by: ? add instructions, to indicate a carry ? subtract instructions, to indicate a borrow ? shift and rotate instructions, to indicate a carry the carry flag is also used as a bit accumulator by bit manipulation instructions. 2.4.5 multiply-accumulate register (mac) this 64-bit register stores the results of multiply -and-accumulate operations. it consists of two 32- bit registers denoted mach and macl. the lower 10 bits of mach are valid; the upper bits are a sign extension. 2.4.6 initial values of cpu registers reset exception handling loads the cp u?s program counter (pc) from the vector table, clears the trace bit in exr to 0, and sets the interrupt mask bits in ccr and exr to 1. the other ccr bits and the general registers are not initialized. in particular, the stack pointer (er7) is not initialized. the stack pointer should therefore be initialized by an mov.l instruction executed immediately after a reset.
section 2 cpu rev. 1.00 mar. 17, 2008 page 30 of 862 rej09b0429-0100 2.5 data formats the h8s/2600 cpu can process 1-bit, 4-bit (bcd), 8-bit (byte), 16-bit (word), and 32-bit (longword) data. bit-manipul ation instructions operate on 1-bit da ta by accessing bit n (n = 0, 1, 2, ?, 7) of byte operand data. the daa and das decimal-adjust instructions treat byte data as two digits of 4-bit bcd data. 2.5.1 general register data formats figure 2.9 shows the data formats in general registers. 7 0 7 0 msb lsb msb lsb 70 4 3 don't care don't care don't care 7 0 4 3 70 don't care 65432 71 0 7 0 don't care 65432 710 don't care rnh rnl rnh rnl rnh rnl data type register number data format byte data byte data 4-bit bcd data 4-bit bcd data 1-bit data 1-bit data upper lower upper lower figure 2.9 general re gister data formats (1)
section 2 cpu rev. 1.00 mar. 17, 2008 page 31 of 862 rej09b0429-0100 15 0 msb lsb 15 0 msb lsb 31 16 msb 15 0 lsb en rn ern: en: rn: rnh: rnl: msb: lsb: general register er general register e general register r general register rh general register rl most significant bit least significant bit data type data format register number word data word data rn en longword data [legend] ern figure 2.9 general re gister data formats (2)
section 2 cpu rev. 1.00 mar. 17, 2008 page 32 of 862 rej09b0429-0100 2.5.2 memory data formats figure 2.10 shows the data formats in memo ry. the h8s/2600 cpu can access word data and longword data in memory, however word or longword data must begin at an even address. if an attempt is made to access word or longword data at an odd address, an address error does not occur, however the least significan t bit of the address is regarded as 0, so access begins the preceding address. this also a pplies to instruction fetches. when er7 is used as an address register to access the stack, the operand size should be word or longword. 70 76 543210 msb lsb msb msb lsb lsb data type address 1-bit data byte data word data address l address l address 2m address 2m+1 longword data address 2n address 2n+1 address 2n+2 address 2n+3 data format figure 2.10 memory data formats
section 2 cpu rev. 1.00 mar. 17, 2008 page 33 of 862 rej09b0429-0100 2.6 instruction set the h8s/2600 cpu has 69 instructions. the instructions are classified by function in table 2.1. table 2.1 instructio n classification function instructions size types data transfer mov b/w/l 5 pop * 1 , push * 1 w/l ldm, stm l movfpe * 3 , movtpe * 3 b add, sub, cmp, neg b/w/l 23 arithmetic operation addx, subx, daa, das b inc, dec b/w/l adds, subs l mulxu, divxu, mulxs, divxs b/w extu, exts w/l tas * 4 b mac, ldmac, stmac, clrmac ? logic operations and, or, xor, not b/w/l 4 shift shal, shar, shll, shlr, ro tl, rotr, rotxl, rotxr b/w/l 8 bit manipulation bset, bclr, bnot, btst, bld, bild, bst, bist, band, biand, bor, bior, bxor, bixor b 14 branch bcc * 2 , jmp, bsr, jsr, rts ? 5 system control trapa, rte, sleep, ldc, stc, andc, orc, xorc, nop ? 9 block data transfer eepmov ? 1 total: 69 notes: b-byte; w-word; l-longword. 1. pop.w rn and push.w rn are identical to mov.w @sp+,rn and mov.w rn,@-sp. pop.l ern and push.l ern are identical to mov.l @sp+,ern and mov.l ern,@-sp. 2. bcc is the general name for conditional branch instructions. 3. cannot be used in this lsi. 4. only register er0, er1, er4, or er5 should be used when using the tas instruction.
section 2 cpu rev. 1.00 mar. 17, 2008 page 34 of 862 rej09b0429-0100 2.6.1 table of instructions classified by function tables 2.3 to 2.10 summarize the instructions in each functional category. the notation used in tables 2.3 to 2.10 is defined below. table 2.2 operation notation symbol description rd general register (destination) * rs general register (source) * rn general register * ern general register (32-bit register) mac multiply-accumulate register (32-bit register) (ead) destination operand (eas) source operand exr extended control register ccr condition-code register n n (negative) flag in ccr z z (zero) flag in ccr v v (overflow) flag in ccr c c (carry) flag in ccr pc program counter sp stack pointer #imm immediate data disp displacement + addition ? subtraction multiplication division logical and logical or logical xor move not (logical complement)
section 2 cpu rev. 1.00 mar. 17, 2008 page 35 of 862 rej09b0429-0100 symbol description :8/:16/:24/:32 8-, 16-, 24-, or 32-bit length note: * general registers include 8-bit registers (r0h to r7h, r0l to r7l), 16-bit registers (r0 to r7, e0 to e7), and 32-bit registers (er0 to er7). table 2.3 data transfer instructions instruction size * function mov b/w/l (eas) rd, rs (ead) moves data between two general registers or between a general register and memory, or moves immediate data to a general register. movfpe b cannot be used in this lsi. movtpe b cannot be used in this lsi. pop w/l @sp+ rn pops a general register from the stack. pop.w rn is identical to mov.w @sp+, rn. pop.l ern is identical to mov.l @sp+, ern. push w/l rn @?sp pushes a general register onto the stack. push.w rn is identical to mov.w rn, @?sp. push.l ern is identical to mov.l ern, @?sp. ldm l @sp+ rn (register list) pops two or more general registers from the stack. stm l rn (register list) @?sp pushes two or more general registers onto the stack. note: * refers to the operand size. b: byte w: word l: longword
section 2 cpu rev. 1.00 mar. 17, 2008 page 36 of 862 rej09b0429-0100 table 2.4 arithmetic operations instructions (1) instruction size * function add sub b/w/l rd rs rd, rd #imm rd performs addition or subtraction on data in two general registers, or on immediate data and data in a general register (immediate byte data cannot be subtracted from byte data in a general register. use the subx or add instruction.) addx subx b rd rs c rd, rd #imm c rd performs addition or subtraction with carry on byte data in two general registers, or on immediate data and data in a general register. inc dec b/w/l rd 1 rd, rd 2 rd increments or decrements a general register by 1 or 2. (byte operands can be incremented or decremented by 1 only.) adds subs l rd 1 rd, rd 2 rd, rd 4 rd adds or subtracts the value 1, 2, or 4 to or from data in a 32-bit register. daa das b rd decimal adjust rd decimal-adjusts an addition or subtracti on result in a general register by referring to the ccr to produce 4-bit bcd data. mulxu b/w rd rs rd performs unsigned multiplication on data in two general registers: either 8 bits 8 bits 16 bits or 16 bits 16 bits 32 bits. mulxs b/w rd rs rd performs signed multiplication on data in two general registers: either 8 bits 8 bits 16 bits or 16 bits 16 bits 32 bits. divxu b/w rd rs rd performs unsigned division on data in two general registers: either 16 bits 8 bits 8-bit quotient and 8-bit remainder or 32 bits 16 bits 16-bit quotient and 16-bit remainder. note: * refers to the operand size. b: byte w: word l: longword
section 2 cpu rev. 1.00 mar. 17, 2008 page 37 of 862 rej09b0429-0100 table 2.4 arithmetic operations instructions (2) instruction size * 1 function divxs b/w rd rs rd performs signed division on data in two general registers: either 16 bits 8 bits 8-bit quotient and 8-bit remainder or 32 bits 16 bits 16-bit quotient and 16-bit remainder. cmp b/w/l rd ? rs, rd ? #imm compares data in a general register with data in another general register or with immediate data, and sets ccr bits according to the result. neg b/w/l 0 ? rd rd takes the two?s complement (arithmetic complement) of data in a general register. extu w/l rd (zero extension) rd extends the lower 8 bits of a 16-bit register to word size, or the lower 16 bits of a 32-bit register to longword size, by padding with zeros on the left. exts w/l rd (sign extension) rd extends the lower 8 bits of a 16-bit register to word size, or the lower 16 bits of a 32-bit register to longword size, by extending the sign bit. tas * 2 b @erd ? 0, 1 ( of @erd) tests memory contents, and sets the most significant bit (bit 7) to 1. mac ? (eas) (ead) + mac mac performs signed multiplication on memory contents and adds the result to the multiply-accumulate register. the following operations can be performed: 16 bits 16 bits + 32 bits 32 bits, saturating 16 bits 16 bits + 42 bits 42 bits, non-saturating clrmac ? 0 mac clears the multiply-accumulate register to zero. ldmac stmac l rs mac, mac rd transfers data between a general register and a multiply-accumulate register. note: 1 . refers to the operand size. b: byte w: word l: longword 2. only register er0, er1, er4, or er5 should be used when using the tas instruction.
section 2 cpu rev. 1.00 mar. 17, 2008 page 38 of 862 rej09b0429-0100 table 2.5 logic operations instructions instruction size * function and b/w/l rd rs rd, rd #imm rd performs a logical and operation on a general register and another general register or immediate data. or b/w/l rd rs rd, rd #imm rd performs a logical or operation on a general register and another general register or immediate data. xor b/w/l rd rs rd, rd #imm rd performs a logical exclusive or operation on a general register and another general register or immediate data. not b/w/l (rd) (rd) takes the one?s complement (logical complement) of general register contents. note: * refers to the operand size. b: byte w: word l: longword table 2.6 shift instructions instruction size * function shal shar b/w/l rd (shift) rd performs an arithmetic shift on general register contents. 1-bit or 2-bit shifts are possible. shll shlr b/w/l rd (shift) rd performs a logical shift on general register contents. 1-bit or 2-bit shifts are possible. rotl rotr b/w/l rd (rotate) rd rotates general register contents. 1-bit or 2-bit rotations are possible. rotxl rotxr b/w/l rd (rotate) rd rotates general register contents through the carry flag. 1-bit or 2-bit rotations are possible. note: * refers to the operand size. b: byte w: word l: longword
section 2 cpu rev. 1.00 mar. 17, 2008 page 39 of 862 rej09b0429-0100 table 2.7 bit manipulation instructions (1) instruction size * function bset b 1 ( of ) sets a specified bit in a general register or memory operand to 1. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. bclr b 0 ( of ) clears a specified bit in a general register or memory operand to 0. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. bnot b ( of ) ( of ) inverts a specified bit in a general register or memory operand. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. btst b ( of ) z tests a specified bit in a general register or memory operand and sets or clears the z flag accordingly. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. band biand b b c ( of ) c ands the carry flag with a specified bit in a general register or memory operand and stores the result in the carry flag. c [ ( of )] c ands the carry flag with the inverse of a specified bit in a general register or memory operand and stores the result in the carry flag. the bit number is specified by 3-bit immediate data. bor bior b b c ( of ) c ors the carry flag with a specified bit in a general register or memory operand and stores the result in the carry flag. c [ ( of )] c ors the carry flag with the inverse of a specified bit in a general register or memory operand and stores the result in the carry flag. the bit number is specified by 3-bit immediate data. note: * refers to the operand size. b: byte
section 2 cpu rev. 1.00 mar. 17, 2008 page 40 of 862 rej09b0429-0100 table 2.7 bit manipulation instructions (2) instruction size * 1 function bxor bixor b b c ( of ) c xors the carry flag with a specified bit in a general register or memory operand and stores the result in the carry flag. c [ ( of )] c xors the carry flag with the inverse of a specified bit in a general register or memory operand and stores the result in the carry flag. the bit number is specified by 3-bit immediate data. bld bild b b ( of ) c transfers a specified bit in a general register or memory operand to the carry flag. ( of ) c transfers the inverse of a specified bit in a general register or memory operand to the carry flag. the bit number is specified by 3-bit immediate data. bst bist b b c ( of ) transfers the carry flag value to a specified bit in a general register or memory operand. c ( of ) transfers the inverse of the carry flag value to a specified bit in a general register or memory operand. the bit number is specified by 3-bit immediate data. note: * refers to the operand size. b: byte
section 2 cpu rev. 1.00 mar. 17, 2008 page 41 of 862 rej09b0429-0100 table 2.8 branch instructions instruction size function bcc ? branches to a specified address if a specified condition is true. the branching conditions are listed below. mnemonic description condition bra(bt) always (true) always brn(bf) never (false) never bhi high c z = 0 bls low or same c z = 1 bcc(bhs) carry clear (high or same) c = 0 bcs(blo) carry set (low) c = 1 bne not equal z = 0 beq equal z = 1 bvc overflow clear v = 0 bvs overflow set v = 1 bpl plus n = 0 bmi minus n = 1 bge greater or equal n v = 0 blt less than n v = 1 bgt greater than z (n v) = 0 ble less or equal z (n v) = 1 jmp ? branches unconditionally to a specified address. bsr ? branches to a subroutine at a specified address. jsr ? branches to a subroutine at a specified address. rts ? returns from a subroutine
section 2 cpu rev. 1.00 mar. 17, 2008 page 42 of 862 rej09b0429-0100 table 2.9 system co ntrol instructions instruction size * function trapa ? starts trap-instruction exception handling. rte ? returns from an exception-handling routine. sleep ? causes a transition to a power-down state. ldc b/w (eas) ccr, (eas) exr moves general register or memory contents or immediate data to ccr or exr. although ccr and exr are 8-bit registers, word-size transfers are performed between them and memory. the upper 8 bits are valid. stc b/w ccr (ead), exr (ead) transfers ccr or exr contents to a general register or memory. although ccr and exr are 8-bit registers, word-size transfers are performed between them and memory. the upper 8 bits are valid. andc b ccr #imm ccr, exr #imm exr logically ands the ccr or exr contents with immediate data. orc b ccr #imm ccr, exr #imm exr logically ors the ccr or exr contents with immediate data. xorc b ccr #imm ccr, exr #imm exr logically xors the ccr or exr contents with immediate data. nop ? pc + 2 pc only increments the program counter. note: * refers to the operand size. b: byte w: word
section 2 cpu rev. 1.00 mar. 17, 2008 page 43 of 862 rej09b0429-0100 table 2.10 block data transfer instructions instruction size function eepmov.b eepmov.w ? ? if r4l 0 then repeat @er5+ @er6+ r4l?1 r4l until r4l = 0 else next; if r4 0 then repeat @er5+ @er6+ r4?1 r4 until r4 = 0 else next; transfers a data block. starting from the address set in er5, transfers data for the number of bytes set in r4l or r4 to the address location set in er6. execution of the next instruction begins as soon as the transfer is completed.
section 2 cpu rev. 1.00 mar. 17, 2008 page 44 of 862 rej09b0429-0100 2.6.2 basic instruction formats the h8s/2600 cpu instructions consist of 2-byte (1-word) units. an instruction consists of an operation field (op field), a register field (r field), an effective address extension (ea field), and a condition field (cc). figure 2.11 shows examples of instruction formats. ? operation field indicates the function of the instruction, the addressing mode, and the operation to be carried out on the operand. the operation field always includes the first four bits of the instruction. some instructions have two operation fields. ? register field specifies a general register. address registers ar e specified by 3 bits, and data registers by 3 bits or 4 bits. some instructions have two register fields. some have no register field. ? effective address extension 8, 16, or 32 bits specifying immediate data, an absolute address, or a displacement. ? condition field specifies the branching condition of bcc instructions. op op rn rm nop, rts, etc. add.b rn, rm, etc. mov.b @(d:16, rn), rm, etc. rn rm op ea(disp) op cc ea(disp) bra d:16, etc. (1) operation field only (2) operation field and register fields (3) operation field, register fields, and effective address extension (4) operation field, effective address extension, and condition field figure 2.11 instruction formats (examples)
section 2 cpu rev. 1.00 mar. 17, 2008 page 45 of 862 rej09b0429-0100 2.7 addressing modes and eff ective address calculation the h8s/2600 cpu supports the eight addressing modes listed in table 2.11. each instruction uses a subset of these addressing modes. arithmetic and logic instructions can use the register direct and immediate modes. data transfer instructi ons can use all addressing modes except program- counter relative and memory indirect. bit manipulation instructions use register direct, register indirect, or the absolute addressing mode to specify an operand, and register direct (bset, bclr, bnot, and btst instructions) or immediate (3-bit) addressing mode to specify a bit number in the operand. table 2.11 addressing modes no. addressing mode symbol 1 register direct rn 2 register indirect @ern 3 register indirect with displacement @(d:16,ern)/@(d:32,ern) 4 register indirect with post-increment register indirect with pre-decrement @ern+ @?ern 5 absolute address @aa:8/@aa:16/@aa:24/@aa:32 6 immediate #xx:8/#xx:16/#xx:32 7 program-counter relative @(d:8,pc)/@(d:16,pc) 8 memory indirect @@aa:8 2.7.1 register direct ? rn the register field of the instruction specifies an 8-, 16-, or 32-bit general register containing the operand. r0h to r7h and r0l to r7l can be specified as 8-bit registers. r0 to r7 and e0 to e7 can be specified as 16-bit registers. er0 to er7 can be specified as 32-bit registers. 2.7.2 register indirect ? @ern the register field of the instruc tion code specifies an address re gister (ern) which contains the address of the operand on memory. if the address is a program instruction address, the lower 24 bits are valid and the upper 8 bits are all assumed to be 0 (h'00).
section 2 cpu rev. 1.00 mar. 17, 2008 page 46 of 862 rej09b0429-0100 2.7.3 register indirect with displacement ? @(d:16, ern) or @(d:32, ern) a 16-bit or 32-bit displacement contained in the inst ruction is added to an address register (ern) specified by the register field of the instructio n, and the sum gives the address of a memory operand. a 16-bit displacement is sign-extended when added. 2.7.4 register indirect with po st-increment or pre-decrement ? @ern+ or @-ern register indirect wi th post-increment ? @ern+: the register field of the instruction code specifies an address register (ern) which contains the address of a memory operand. after the operand is accessed, 1, 2, or 4 is added to the addr ess register contents and the sum is stored in the address register. the value added is 1 for byte acce ss, 2 for word transfer instruction, or 4 for longword transfer instruction. for the word or longword transfer instructions, the register value should be even. register indirect wi th pre-decrement ? @-ern: the value 1, 2, or 4 is subtracted from an address register (ern) specified by the register fi eld in the instruction code, and the result is the address of a memory operand. the result is also stored in the address register. the value subtracted is 1 for byte access, 2 for word transf er instruction, or 4 for longword transfer instruction. for the word or longword transfer instructions, the register value should be even. 2.7.5 absolute address ? @aa:8, @aa:16, @aa:24, or @aa:32 the instruction code contains th e absolute address of a memory operand. the absolute address may be 8 bits long (@aa:8), 16 bits long (@aa:16), 24 bits long (@aa:24), or 32 bits long (@aa:32). table 2.12 indicates the acce ssible absolute address ranges. to access data, the absolute address should be 8 bits (@aa:8), 16 bits (@aa:16), or 32 bits (@aa:32) long. for an 8-bit absolute address, th e upper 24 bits are all a ssumed to be 1 (h'ffff). for a 16-bit absolute address the upper 16 bits are a sign extension. a 32-bit absolute address can access the entire address space. a 24-bit absolute address (@aa:24) indicates the address of a program instruction. the upper 8 bits are all assumed to be 0 (h'00).
section 2 cpu rev. 1.00 mar. 17, 2008 page 47 of 862 rej09b0429-0100 table 2.12 absolute address access ranges absolute address normal mode * advanced mode data address 8 bits (@aa:8) h'ff00 to h'ffff h'ffff00 to h'ffffff 16 bits (@aa:16) h'0000 to h'ffff h'000000 to h'007fff, h'ff8000 to h'ffffff 32 bits (@aa:32) h'000000 to h'ffffff program instruction address 24 bits (@aa:24) note: normal mode is not available in this lsi. 2.7.6 immediate ? #xx:8, #xx:16, or #xx:32 the instruction contains 8-bit (#xx:8), 16-bit (#xx:16), or 32-bit (#xx:32) immediate data as an operand. the adds, subs, inc, and dec instructions contain immediate data implicitly. some bit manipulation instructions contain 3-bit immediate data in the instruction code, specifying a bit number. the trapa instruction contains 2-bit immediate data in its instruction code, specifying a vector address. 2.7.7 program-counter relative ? @(d:8, pc) or @(d:16, pc) this mode is used in the bcc and bsr instructions. an 8-bit or 16-bit displacement contained in the instruction is sign-extended and added to the 24-bit pc contents to generate a branch address. only the lower 24 bits of this branch address are valid; the upper 8 bits are all assumed to be 0 (h 00). the pc value to which the di splacement is added is the addre ss of the first byte of the next instruction, so the possible branching range is ?126 to +128 bytes (?63 to +64 words) or ?32766 to +32768 bytes (?16383 to +16384 words) from the branch instruction. the resulting value should be an even number.
section 2 cpu rev. 1.00 mar. 17, 2008 page 48 of 862 rej09b0429-0100 2.7.8 memory indirect ? @@aa:8 this mode can be used by the jmp and jsr instructions. the instruction code contains an 8-bit absolute address specifying a memory operand. this memory operand contains a branch address. the upper bits of the absolute address are all a ssumed to be 0, so the address range is 0 to 255 (h'0000 to h'00ff in normal mode, h'000000 to h' 0000ff in advanced mode). in normal mode, the memory operand is a word operand and the branch address is 16 bits long. in advanced mode, the memory operand is a longword operand, the first byte of which is assumed to be 0 (h'00). note that the first part of the address range is also the exception vector area. for further details, refer to section 4, exception handling. if an odd address is specified in word or longwor d memory access, or as a branch address, the least significant bit is regarded as 0, causing data to be accessed or instruction code to be fetched at the address preceding the specified address. (for further informa tion, see section 2.5.2, memory data formats.) note: normal mode is not available in this lsi. specified by @aa:8 specified by @aa:8 branch address branch address reserved (a) normal mode * (a) advanced mode note: * normal mode is not available in this lsi. figure 2.12 branch a ddress specification in memory indirect mode
section 2 cpu rev. 1.00 mar. 17, 2008 page 49 of 862 rej09b0429-0100 2.7.9 effective address calculation table 2.13 indicates how effec tive addresses are calculated in each addressing mode. in normal mode the upper 8 bits of the effective address are ignored in order to generate a 16-bit address. note: normal mode is not available in this lsi. table 2.13 effective a ddress calculation (1) no 1 offset 1 2 4 r o p 31 0 31 23 2 3 register indi rect with di splacement @(d: 16,ern) or @(d: 32,ern) 4 r o p dis p r op rm op rn 3 1 0 3 1 0 r o p d on't care 3 1 2 3 3 1 0 do n't ca re 31 0 disp 31 0 31 0 31 23 31 0 d on't ca re 31 23 31 0 don't care 24 24 24 24 addressing mode and instruction format effective address calculation effective address (ea) register direct(rn) general register contents general register contents general register contents general register contents sign extension register indirect(@ern) register indirect with post-increment or pre-decrement register indirect with post-increment @ern+ register indirect with pre-decrement @-ern 1, 2, or 4 1, 2, or 4 operand size byte word longword operand is general register contents.
section 2 cpu rev. 1.00 mar. 17, 2008 page 50 of 862 rej09b0429-0100 table 2.13 effective a ddress calculation (2) no 5 op 31 23 31 0 don't care abs @aa:8 7 h'ffff op 31 23 31 0 don't care @aa:16 op @aa :24 @aa :32 abs 15 16 31 23 31 0 do n't care 31 23 31 0 do n't care abs op abs 6 op imm #xx :8 /#xx :16 /#xx :32 8 24 24 24 24 addressing mode and instruction format absolute address immediate effective address calculation effective address (ea) sign extension operand is immediate data. 31 23 7 p rog ram- counter re lativ e @ (d:8 ,pc )/@( d:16 ,pc) me mor y indi rect @@ aa:8  no rma l mo de *  adv ance d m ode 31 0 d on't care 23 0 dis p 0 31 23 31 0 don't care di sp op 23 op 8 abs 31 0 abs h'000000 7 8 0 15 31 2 3 31 0 don't care 1 5 h '00 16 o p abs 31 0 abs h'000000 7 8 0 31 24 24 24 note: * normal mode is not available in this lsi. pc contents sign extension memory contents memory contents
section 2 cpu rev. 1.00 mar. 17, 2008 page 51 of 862 rej09b0429-0100 2.8 processing states the h8s/2600 cpu has four main processing states: the reset state, exception handling state, program execution state and power-down state. figure 2.13 indicates the state transitions. ? reset state in this state, the cpu and all on-chip peripheral modules are initialized and not operating. when the res input goes low, all current processing stops and the cpu enters the reset state. all interrupts are masked in the reset stat e. reset exception hand ling starts when the res signal changes from low to high. for details , refer to section 4, exception handling. the reset state can also be entered by a watchdog timer overflow. ? exception-handling state the exception-handling state is a transient state that occurs when the cp u alters the normal processing flow due to an exception source, such as a reset, trace, interrupt, or trap instruction. the cpu fetches a start address (vector) from th e exception vector table and branches to that address. for further details, refer to section 4, exception handling. ? program execution state in this state, the cpu executes pr ogram instructions in sequence. ? program stop state this is a power-down state in which the cpu stops operating. the program stop state occurs when a sleep instruction is executed or the cpu enters software standby mode. for further details, refer to section 24, power-down modes.
section 2 cpu rev. 1.00 mar. 17, 2008 page 52 of 862 rej09b0429-0100 end of bus request bus request program execution state bus-released state sleep mode exception-handling state software standby mode res = high reset state stby = high, res = low hardware standby mode * 2 power-down state * 1 notes: 1. 2. from any state except hardware standby mode, a transition to the reset state occurs whenever res goes low. a transition can also be made to the reset state when the watchdog timer overflows. from any state, a transition to hardware standby mode occurs when stby goes low. sleep instruction with ssby = 0 interrupt request end of bus request bus request request for exception handling end of exception handling external interrupt request sleep instruction with pss = 0 and ssby = 1 figure 2.13 state transitions
section 2 cpu rev. 1.00 mar. 17, 2008 page 53 of 862 rej09b0429-0100 2.9 usage note 2.9.1 notes on using the bit operation instruction instructions bset, bclr, bnot, bst, and bist read data in byte units, and write data in byte units after bit operation. therefore, attention must be paid when these instructions are used for ports or registers including write-only bits. instruction bclr can be used to clear the flag in the internal i/o register to 0. if it is obvious that the flag has been set to 1 by the interrupt processing routine, it is unnecessary to read the flag beforehand.
section 2 cpu rev. 1.00 mar. 17, 2008 page 54 of 862 rej09b0429-0100
section 3 mcu operating modes rev. 1.00 mar. 17, 2008 page 55 of 862 rej09b0429-0100 section 3 mcu operating modes 3.1 operating mode selection this lsi supports one operating mode (mode 2). the operating mode is determined by the setting of the mode pins ( md2 , md1, and md0). table 3.1 shows the mcu operating mode selection. table 3.1 mcu operating mode selection mcu operating mode md2 md1 md0 cpu operating mode description 2 1 1 0 advanced extended mode with on-chip rom single-chip mode mode 2 is single-chip mode after a reset. the cpu can switch to extended mode by setting bit expe in mdcr to 1. modes 0, 1, 3, 5, and 7 are not available in this lsi. modes 4 and 6 are operating mode for a special purpose. thus, mode pins should be set to enable mode 2 in normal program execution state. mode pins should not be changed during operation.
section 3 mcu operating modes rev. 1.00 mar. 17, 2008 page 56 of 862 rej09b0429-0100 3.2 register descriptions the following registers are related to the operating mode. for details on the bus control register (bcr), see section 6.3.1, bus control register (bcr), and for details on bus control register 2 (bcr2), see section 6.3.2, bus control register 2 (bcr2). ? mode control register (mdcr) ? system control register (syscr) ? serial timer control register (stcr) 3.2.1 mode control register (mdcr) mdcr is used to set an operating mode and to monitor the current operating mode. bit bit name initial value r/w description 7 expe 0 r/w extended mode enable specifies extended mode. 0: single-chip mode 1: extended mode 6 to 3 ? all 0 r reserved 2 1 0 mds2 mds1 mds0 ? * ? * ? * r r r mode select 2, 1, and 0 these bits indicate the input levels at mode pins ( md2 , md1, and md0) (the current operating mode). bits mds2, mds1, and mds0 correspond to md2 , md1, and md0, respectively. mds2 and mds1 are read-only bits and they cannot be written to. the mode pin ( md2 , md1, and md0) input levels are latched into these bits when mdcr is read. these latches are canceled by a reset. note: * the initial values are determined by the settings of the md2 , md1, and md0 pins.
section 3 mcu operating modes rev. 1.00 mar. 17, 2008 page 57 of 862 rej09b0429-0100 3.2.2 system control register (syscr) syscr selects a system pin function, monitors a reset source, selects the interrupt control mode and the detection edge for nmi, enables or disa bles register access to the on-chip peripheral modules, and enables or disables on-chip ram address space. bit bit name initial value r/w description 7 cs256e 0 r/w chip select 256 enable enables or disables p97/ wait / cs256 pin function in extended mode. 0: p97/ wait pin wait pin function is selected by the settings of wscr and wscr2. 1: cs256 pin outputs low when a 256-kbyte expansion area of addresses h'f80000 to h'fbffff is accessed. 6 iose 0 r/w ios enable enables or disables as / ios pin function in extended mode. 0: as pin outputs low when an external area is accessed. 1: ios pin outputs low when an ios expansion area of addresses h'fff000 to h'fff7ff is accessed. 5 4 intm1 intm0 0 0 r r/w these bits select the control mode of the interrupt controller. for details on the interrupt control modes, see section 5.6, interrupt control modes and interrupt operation. 00: interrupt control mode 0 01: interrupt control mode 1 10: setting prohibited 11: setting prohibited
section 3 mcu operating modes rev. 1.00 mar. 17, 2008 page 58 of 862 rej09b0429-0100 bit bit name initial value r/w description 3 xrst 1 r external reset this bit indicates the reset source. a reset is caused by an external reset input, or when the watchdog timer overflows. 0: a reset is caused when the watchdog timer overflows. 1: a reset is caused by an external reset. 2 nmieg 0 r/w nmi edge select selects the valid edge of the nmi interrupt input. 0: an interrupt is requested at the falling edge of nmi input 1: an interrupt is requested at the rising edge of nmi input 1 ? 0 r/w reserved the initial value should not be changed. 0 rame 1 r/w ram enable enables or disables on-chip ram. the rame bit is initialized when the reset state is released. 0: on-chip ram is disabled 1: on-chip ram is enabled 3.2.3 serial timer control register (stcr) stcr enables or disables register access, iic operating mode, and on-c hip flash memory, and selects the input clock of the timer counter. bit bit name initial value r/w description 7 6 5 iicx2 iicx1 iicx0 0 0 0 r/w r/w r/w iic transfer rate select 2, 1, and 0 these bits control the iic operation. these bits select a transfer rate in master mode together with bits cks2 to cks0 in the i 2 c bus mode register (icmr). for details on the transfer rate, see table 17.3. the iicxn bit controls iic_n. (n = 0 to 2)
section 3 mcu operating modes rev. 1.00 mar. 17, 2008 page 59 of 862 rej09b0429-0100 bit bit name initial value r/w description 4 ? 0 r/w reserved the initial value should not be changed. 3 flshe 0 r/w flash memory control register enable enables or disables cpu access for flash memory registers (fccs, fpcs, fecs, fkey, fmats, ftdar), control registers of power-down states (sbycr, lpwrcr, mstpcrh, mstpcrl), and control registers of on-chip peripheral modules (bcr2, wscr2, pcsr, syscr2). 0: area from h'fffe88 to h'fffe8f is reserved. control registers of power-down states and on-chip peripheral modules are accessed in an area from h'ffff80 to h'ffff87. 1: control registers of flash memory are accessed in an area from h'fffe88 to h'fffe8f. area from h'ffff80 to h'ffff87 is reserved. 2 ? 1 r/w reserved the initial value should not be changed. 1 0 icks1 icks0 0 0 r/w r/w internal clock source select 1, 0 these bits select a clock to be input to the timer counter (tcnt) and a count condition together with bits cks2 to cks0 in the timer control register (tcr). for details, see section 11.2.4, timer control register (tcr).
section 3 mcu operating modes rev. 1.00 mar. 17, 2008 page 60 of 862 rej09b0429-0100 3.3 operating mode descriptions 3.3.1 mode 2 the cpu can access a 16 mbytes address space in advanced mode. the on-chip rom is enabled. after a reset, the lsi is set to single-chip mode . to access an external address space, bit expe in mdcr should be set to 1. ? normal extended mode in extended modes, ports 1 and 2 function as input ports after a reset. ports 1 and 2 function as an address bus by setting 1 to the corresponding port data direction register (ddr). port 3 functions as a data bus port, and parts of port 9 carry bus control signals. port 6 functions as a data bus port when the abw bit in wscr is cleared to 0. ? multiplex extended mode when 8-bit bus is specified, port 1 functions as the port for address output and data input/output regardless of the setting of the data direction register (ddr). port 2 can be used as a general port. when 16-bit bus is specified, ports 1 and 2 function as the port for address output and data input/output regardless of the setting of the data direction register (ddr).
section 3 mcu operating modes rev. 1.00 mar. 17, 2008 page 61 of 862 rej09b0429-0100 3.4 address map figure 3.1 shows the memory map in operating modes. rom: 512 kbytes, ram: 40 kbytes mode 2 (expe = 1) advanced mode extended mode with on-chip rom rom: 512 kbytes, ram: 40 kbytes mode 2 (expe = 0) advanced mode single-chip mode h'000000 h'000000 on-chip rom on-chip rom internal i/o registers 2 internal i/o registers 1 h'ffefff h'ffe080 h'fffeff h'ffffff h'fffe40 h'ffff7f h'ffff80 h'ffff00 on-chip ram (128 bytes) external address space internal i/o registers 2 internal i/o registers 1 h'ffefff h'ffe080 h'fffeff h'fffe40 h'ffff7f h'ffff80 h'ffff00 on-chip ram (128 bytes) h'ffffff * reserved area reserved area on-chip ram (36 kbytes) external address space on-chip ram (3,968 bytes) internal i/o registers 3 on-chip ram (3,968 bytes) reserved area reserved area on-chip ram (36 kbytes) h'ff0000 h'ff0000 h'ff07ff h'ff07ff h'ff0800 h'ff0800 h'ff97ff h'ffbfff h'ffdfff internal i/o registers 3 h'fff800 h'fffe3f h'fff800 h'fffe3f h'ff9800 h'ff97ff h'ff9800 h'07ffff external address space h'07ffff h'f80000 h'fbffff external address space 256 kbytes extended area notes: * these areas can be used as an external address space by clearing bit rame in syscr to 0. h'080000 h'f7ffff h'feffff h'fc0000 h'ffe07f h'ffe000 h'fff7ff h'fff000 * * * (ios extended area) figure 3.1 address map
section 3 mcu operating modes rev. 1.00 mar. 17, 2008 page 62 of 862 rej09b0429-0100
section 4 exception handling rev. 1.00 mar. 17, 2008 page 63 of 862 rej09b0429-0100 section 4 exception handling 4.1 exception handling types and priority as table 4.1 indicates, exception handling may be caused by a reset, interrupt, illegal instruction, or trap instruction. exception handling is prioritized as shown in table 4.1. if two or more exceptions occur simultaneously , they are accepted and processed in order of priority. table 4.1 exception types and priority priority exception type start of exception handling high reset starts immediately after a low-to-high transition of the res pin, or when the watchdog timer overflows. illegal instruction started by execution of an undefined code. interrupt starts when execution of the current instruction or exception handling ends, if an interrupt request has been issued. interrupt detection is not performed on completion of andc, orc, xorc, or ldc instruction execution, or on completion of reset exception handling. low trap instruction started by execution of a trap (trapa) instruction. trap instruction exception handling requests are accepted at all times in program execution state.
section 4 exception handling rev. 1.00 mar. 17, 2008 page 64 of 862 rej09b0429-0100 4.2 exception sources and exception vector table different vector addresses are a ssigned to different exception sources. table 4.2 lists the exception sources and their vector addresses. table 4.2 exception handling vector table vector address exception source vector number advanced mode reset 0 h'000000 to h'000003 reserved for system use 1 ? 3 h'000004 to h'000007 | h'00000c to h'00000f illegal instruction 4 h'000010 to h'000013 reserved for system use 5 h'000014 to h'000017 6 h'000018 to h'00001b external interrupt (nmi) 7 h'00001c to h'00001f 8 h'000020 to h'000023 9 h'000024 to h'000027 10 h'000028 to h'00002b trap instruction (four sources) 11 h'00002c to h'00002f reserved for system use 12 ? 15 h'000030 to h'000033 | h'00003c to h'00003f irq0 16 h'000040 to h'000043 irq1 17 h'000044 to h'000047 irq2 18 h'000048 to h'00004b irq3 19 h'00004c to h'00004f irq4 20 h'000050 to h'000053 irq5 21 h'000054 to h'000057 irq6 22 h'000058 to h'00005b external interrupt irq7 23 h'00005c to h'00005f internal interrupt * 24 ? 29 h'000060 to h'000063 ? h'000074 to h'000077
section 4 exception handling rev. 1.00 mar. 17, 2008 page 65 of 862 rej09b0429-0100 vector address exception source vector number advanced mode 30 h'000078 to h'00007b ? ? reserved for system use 33 h'000084 to h'000087 internal interrupt * 34 ? 55 h'000088 to h'00008b ? h'0000dc to h'0000df irq8 56 h'0000e0 to h'0000e3 irq9 57 h'0000e4 to h'0000e7 irq10 58 h'0000e8 to h'0000eb irq11 59 h'0000ec to h'0000ef irq12 60 h'0000f0 to h'0000f3 irq13 61 h'0000f4 to h'0000f7 irq14 62 h'0000f8 to h'0000fb external interrupt irq15 63 h'0000fc to h'0000ff internal interrupt * 64 ? 107 h'000100 to h'000103 ? h'0001ac to h'0001af note: * for details on the internal interrupt vector table, see section 5.5, interrupt exception handling vector table.
section 4 exception handling rev. 1.00 mar. 17, 2008 page 66 of 862 rej09b0429-0100 4.3 reset a reset has the highest exception priority. when the res pin goes low, all processing halts and this lsi enters the reset. to ensure that this lsi is reset, hold the res pin low for at least 20 ms at power-on. to reset the chip during operation, hold the res pin low for at least 20 states. a reset initializes the internal state of the cpu and the registers of on-chip peripheral modules. the chip can also be reset by overflow of the watchdog timer. for details, see section 12, watchdog timer (wdt). 4.3.1 reset exception handling when the res pin goes high after being held low for the necessary time, this lsi starts reset exception handling as follows: 1. the internal state of the cpu and the registers of the on-chip peripheral modules are initialized and the i bit in ccr is set to 1. 2. the reset exception handling vector address is read and transferred to the pc, and program execution starts from the address indicated by the pc. figure 4.1 shows an example of the reset sequence.
section 4 exception handling rev. 1.00 mar. 17, 2008 page 67 of 862 rej09b0429-0100 res internal address bus internal read signal internal write signal internal data bus vector fetch (1) reset exception handling vector address (1) u = h'000000 (1) l = h'000002 (2) start address (contents of reset exception handling vector address) (3) start address ((3) = (2)u + (2)l) (4) first program instruction (1) u (3) high internal processing prefetch of first program instruction (2) (2) (4) ul (1) l figure 4.1 reset sequence 4.3.2 interrupts after reset if an interrupt is accepted after a reset and before the stack pointer (sp) is initialized, the pc and ccr will not be saved correctly, leading to a program crash. to prevent this, all interrupt requests, including nmi, are disabled immedi ately after a reset. since the first instruction of a program is always executed immediately after the reset state ends, make sure that this instruction initializes the stack pointer (example: mov.l #xx: 32, sp). 4.3.3 on-chip peripheral modules after reset is cancelled after a reset is cancelled, the module stop control registers (mstpcr, mstpcra, submstpb, and submstpa) are initialized, and all modules except the dtc operate in module stop mode. therefore, the registers of on-chip peripheral modules cannot be read from or written to. to read from and write to these registers, clear module stop mode.
section 4 exception handling rev. 1.00 mar. 17, 2008 page 68 of 862 rej09b0429-0100 4.4 interrupt exception handling interrupts are controlled by the interrupt controller. the sources to start interrupt exception handling are external interrupt sources (nmi and irq15 to irq0) and internal interrupt sources from the on-chip peripheral modules. nmi is an interrupt with the highest priority. for details, see section 5, interrupt controller. interrupt exception handling is conducted as follows: 1. the values in the program counter (pc) and condition code register (ccr) are saved to the stack. 2. a vector address corresponding to the interrupt source is generated, the start address is loaded from the vector table to the pc, and program execution begins from that address. 4.5 trap instruction exception handling trap instruction exception handling starts when a trapa instruction is executed. trap instruction exception handling can be executed at a ll times in the program execution state. trap instruction exception handling is conducted as follows: 1. the values in the program counter (pc) and condition code register (ccr) are saved to the stack. 2. a vector address corresponding to the interrupt source is generated, the start address is loaded from the vector table to the pc, and prog ram execution starts from that address. the trapa instruction fetches a start address from a vector table entry corresponding to a vector number from 0 to 3, as specified in the instruction code. table 4.3 shows the status of ccr after execution of trap instruction exception handling. table 4.3 status of ccr after trap instruction exception handling ccr interrupt control mode i ui 0 set to 1 retains value prior to execution 1 set to 1 set to 1
section 4 exception handling rev. 1.00 mar. 17, 2008 page 69 of 862 rej09b0429-0100 4.6 stack status after exception handling figure 4.2 shows the stack after completion of trap instruction exception handling and interrupt exception handling. advanced mode ccr pc (24 bits) sp figure 4.2 stack status after exception handling
section 4 exception handling rev. 1.00 mar. 17, 2008 page 70 of 862 rej09b0429-0100 4.7 usage note when accessing word data or longword data, this lsi assumes that the lowest address bit is 0. the stack should always be accessed in words or longw ords, and the value of the stack pointer (sp: er7) should always be kept even. use the following instructions to save registers: push.w rn (or mov.w rn, @-sp ) push.l ern (or mov.l ern, @-sp ) use the following instructions to restore registers: pop.w rn (or mov.w @sp+, rn ) pop.l ern (or mov.l @sp+, ern ) setting sp to an odd value may lead to a malfunction. figure 4.3 shows an example of what happens when the sp value is odd. condition code register program counter general register r1l stack pointer trapa instruction executed sp set to h'fffeff data saved above sp mov.b r1l, @-er7 executed contents of ccr lost address [legend] note: this diagram illustrates an example in which the interrupt control mode is 0. h'fffefa h'fffefb h'fffefc h'fffefd h'fffeff sp ccr sp sp r1l pc pc ccr: pc: r1l: sp: figure 4.3 operation when sp value is odd
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 71 of 862 rej09b0429-0100 section 5 interrupt controller 5.1 features ? two interrupt control modes any of two interrupt control modes can be set by means of the intm1 and intm0 bits in the system control register (syscr). ? priorities settable with icr an interrupt control register (icr) is provided for setting interrupt priorities. priority levels can be set for each module fo r all interrupts except nmi. ? three-level interrupt mask control by means of the interrupt control mode, i and ui bits in ccr, and icr, 3-level interrupt mask control is performed. ? independent vector addresses all interrupt sources are assigned independent vector addresses, making it unnecessary for the source to be identified in the interrupt handling routine. ? thirty-three external interrupts nmi is the highest-priority interrupt, and is accepted at all times. rising edge or falling edge detection can be selected for nmi. falling-edge, rising-edge, or both-edge detection, or level sensing, can be selected for irqn (n = 15 to 0) and exirqn (n = 15 to 0). ? dtc control the dtc can be activated by an interrupt request.
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 72 of 862 rej09b0429-0100 syscr nmi input irq input internal interrupt sources swdtend to ibfi3 nmieg intm1, intm0 nmi input irq input isr iscr ier icr interrupt controller priority level determination interrupt request vector number i, ui ccr cpu icr: iscr: ier: isr: syscr: interrupt control register irq sense control register irq enable register irq status register system control register [legend] figure 5.1 block diagram of interrupt controller 5.2 input/output pins table 5.1 summarizes the pins of the interrupt controller. table 5.1 pin configuration symbol i/o function nmi input nonmaskable external interrupt rising edge or falling edge can be selected irq15 to irq0 exirq15 to exirq0 input maskable external interrupts rising edge, falling edge, or both edges, or level sensing can be selected individually for each pin. pin of irqn or exirqn to input irqn (n = 15 to 0) interrupt can be selected.
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 73 of 862 rej09b0429-0100 5.3 register descriptions the interrupt controller has the following registers. for details on the system control register (syscr), see section 3.2.2, system control register (syscr), and for details on the irq sense port select registers (issr16 and issr), see section 8.16.1, irq sense port select register 16 (issr16), irq sense port select register (issr). ? interrupt control registers a to d (icra to icrd) ? address break control register (abrkcr) ? break address registers a to c (bara to barc) ? irq sense control registers (iscr16h, iscr16l, iscrh, and iscrl) ? irq enable registers (ier16 and ier) ? irq status registers (isr16 and isr) 5.3.1 interrupt control registers a to d (icra to icrd) the icr registers set interrupt control levels for interrupts other than nmi. the correspondence between interrupt sources and ic ra to icrd settings is shown in table 5.2. bit bit name initial value r/w description 7 to 0 icrn7 to ircn0 all 0 r/w interrupt control level 0: corresponding interrupt source is interrupt control level 0 (no priority) 1: corresponding interrupt source is interrupt control level 1 (priority) [legend] n: a to d
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 74 of 862 rej09b0429-0100 table 5.2 correspondence betwee n interrupt source and icr register bit bit name icra icrb icrc icrd 7 icrn7 irq0 a/d converte r sci_3 irq8 to irq11 6 icrn6 irq1 frt sci_1 irq12 to irq15 5 icrn5 irq2, irq3 ? ? ? 4 icrn4 irq4, irq5 tmr_x iic_0 ? 3 icrn3 irq6, irq7 tmr_0 iic_1 ? 2 icrn2 dtc tmr_1 iic_2, iic_3 ? 1 icrn1 wdt_0 tmr_y lpc scif 0 icrn0 wdt_1 iic_4, iic_5 ? ? [legend]] n: a to d ? : reserved. the write value should always be 0. 5.3.2 address break cont rol register (abrkcr) abrkcr controls the address breaks. when both the cmf flag and bie flag are set to 1, an address break is requested. bit bit name initial value r/w description 7 cmf undefined r condition match flag address break source flag. indicates that an address specified by bara to barc is prefetched. [clearing condition] when an exception handling is executed for an address break interrupt. [setting condition] when an address specified by bara to barc is prefetched while the bie flag is set to 1. 6 to 1 ? all 0 r reserved these bits are always read as 0 and cannot be modified. 0 bie 0 r/w break interrupt enable enables or disables address break. 0: disabled 1: enabled
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 75 of 862 rej09b0429-0100 5.3.3 break address registers a to c (bara to barc) the bar registers specify an address that is to be a break address. an address in which the first byte of an instruction exists should be set as a break address. ? bara bit bit name initial value r/w description 7 to 0 a23 to a16 all 0 r/w addresses 23 to 16 the a23 to a16 bits are compared with a23 to a16 in the internal address bus. ? barb bit bit name initial value r/w description 7 to 0 a15 to a8 all 0 r/w addresses 15 to 8 the a15 to a8 bits are compared with a15 to a8 in the internal address bus. ? barc bit bit name initial value r/w description 7 to 1 a7 to a1 all 0 r/w addresses 7 to 1 the a7 to a1 bits are compared with a7 to a1 in the internal address bus. 0 ? 0 r reserved this bit is always read as 0 and cannot be modified.
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 76 of 862 rej09b0429-0100 5.3.4 irq sense control registers (iscr16h, iscr16l, iscrh, iscrl) the iscr registers select the source that generates an interrupt request at pins irq15 to irq0 or pins exirq15 to exirq0 . ? iscr16h bit bit name initial value r/w description 7 6 irq15scb irq15sca 0 0 r/w r/w 5 4 irq14scb irq14sca 0 0 r/w r/w 3 2 irq13scb irq13sca 0 0 r/w r/w 1 0 irq12scb irq12sca 0 0 r/w r/w irqn sense control b irqn sense control a 00: interrupt request generated at low level of irqn * or exirqn input 01: interrupt request generated at falling edge of irqn * or exirqn input 10: interrupt request generated at rising edge of irqn * or exirqn input 11: interrupt request generated at both falling and rising edges of irqn * or exirqn input (n = 15 to 12) note: * irqn stands for irq15 to irq12 . ? iscr16l bit bit name initial value r/w description 7 6 irq11scb irq11sca 0 0 r/w r/w 5 4 irq10scb irq10sca 0 0 r/w r/w 3 2 irq9scb irq9sca 0 0 r/w r/w 1 0 irq8scb irq8sca 0 0 r/w r/w irqn sense control b irqn sense control a 00: interrupt request generated at low level of irqn * or exirqn input 01: interrupt request generated at falling edge of irqn * or exirqn input 10: interrupt request generated at rising edge of irqn * or exirqn input 11: interrupt request generated at both falling and rising edges of irqn * or exirqn input (n = 11 to 8) note: * irqn stands for irq11 to irq8 .
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 77 of 862 rej09b0429-0100 ? iscrh bit bit name initial value r/w description 7 6 irq7scb irq7sca 0 0 r/w r/w 5 4 irq6scb irq6sca 0 0 r/w r/w 3 2 irq5scb irq5sca 0 0 r/w r/w 1 0 irq4scb irq4sca 0 0 r/w r/w irqn sense control b irqn sense control a 00: interrupt request generated at low level of irqn or exirqn input 01: interrupt request generated at falling edge of irqn or exirqn input 10: interrupt request generated at rising edge of irqn or exirqn input 11: interrupt request generated at both falling and rising edges of irqn or exirqn input (n = 7 to 4) note: * irqn stands for irq7 to irq4 . ? iscrl bit bit name initial value r/w description 7 6 irq3scb irq3sca 0 0 r/w r/w 5 4 irq2scb irq2sca 0 0 r/w r/w 3 2 irq1scb irq1sca 0 0 r/w r/w 1 0 irq0scb irq0sca 0 0 r/w r/w irqn sense control b irqn sense control a 00: interrupt request generated at low level of irqn or exirqn input 01: interrupt request generated at falling edge of irqn or exirqn input 10: interrupt request generated at rising edge of irqn or exirqn input 11: interrupt request generated at both falling and rising edges of irqn or exirqn input (n = 3 to 0) note: * irqn stands for irq3 to irq0 .
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 78 of 862 rej09b0429-0100 5.3.5 irq enable registers (ier16, ier) the ier registers control the enabling and disabling of interrupt requests irq15 to irq0. ? ier16 bit bit name initial value r/w description 7 to 0 irq15e to irq8e all 0 r/w irqn enable (n = 15 to 8) the irqn interrupt request is enabled when this bit is 1. ? ier bit bit name initial value r/w description 7 to 0 irq7e to irq0e all 0 r/w irqn enable (n = 7 to 0) the irqn interrupt request is enabled when this bit is 1.
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 79 of 862 rej09b0429-0100 5.3.6 irq status registers (isr16, isr) the isr registers are flag register s that indicate the status of irq15 to irq0 interrupt requests. ? isr16 bit bit name initial value r/w description 7 to 0 irq15f to irq8f all 0 r/w [setting condition] ? when the interrupt source selected by the iscr16 registers occurs [clearing conditions] ? when reading 1, then writing 0 ? when interrupt exception handling is executed when low-level detection is set and irqn * or exirqn input is high ? when irqn interrupt exception handling is executed when falling-edge, rising-edge, or both-edge detection is set (n = 15 to 8) note: * irqn stands for irq15 to irq8 . ? isr bit bit name initial value r/w description 7 to 0 irq7f to irq0f all 0 r/w [setting condition] ? when the interrupt source selected by the iscr registers occurs [clearing conditions] ? when reading 1, then writing 0 ? when interrupt exception handling is executed when low-level detection is set and irqn * or exirqn input is high ? when irqn interrupt exception handling is executed when falling-edge, rising-edge, or both-edge detection is set (n = 7 to 0) note: * irqn stands for irq7 to irq0 .
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 80 of 862 rej09b0429-0100 5.4 interrupt sources 5.4.1 external interrupts there are four external interrupts: nmi, irq15 to irq0. these interrupts can be used to restore this lsi from software standby mode. nmi interrupt: nmi is the highest-priority interrupt, and is always accepted by the cpu regardless of the interrupt control mode or the status of the cpu interrupt mask bits. the nmieg bit in syscr can be used to select whether an interrupt is requested at a rising edge or a falling edge on the nmi pin. irq15 to irq0 interrupts: interrupts irq15 to irq0 are requested by an input signal at pins irq15 to irq0 or pins exirq15 to exirq0 . interrupts irq15 to irq0 have the following features: ? the interrupt exception handling for interrupt requests irq15 to irq0 can be started at an independent vector address. ? using iscr, it is possible to select whether an interrupt is generated by a low level, falling edge, rising edge, or both edges, at pins irq15 to irq0 or pins exirq15 to exirq0 . ? enabling or disabling of interrupt requests irq15 to irq0 can be selected with ier. ? the status of interrupt requests irq15 to irq0 is indicated in isr. isr flags can be cleared to 0 by software. the detection of irq15 to irq0 interrupts does not depend on whether the relevant pin has been set for input or output. however, when a pin is used as an external interrupt input pin, clear the corresponding port ddr to 0 so that it is not used as an i/o pin for another function. a block diagram of interrupts irq15 to irq0 is shown in figure 5.2.
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 81 of 862 rej09b0429-0100 irqn interrupt request irqne irqnf s r q clear signal edge/level detection circuit irqnsca, irqnscb irqn input or exirqn * input n = 15 to 0 figure 5.2 block diagram of interrupts irq15 to irq0 5.4.2 internal interrupts internal interrupts issued from the on-chip peripheral modules have the following features: ? for each on-chip peripheral modul e there are flags that indicate the interrupt request status, and enable bits that individually select enabling or disabling of these interrupts. when the enable bit for a particular interrupt source is set to 1, an interrupt request is sent to the interrupt controller. ? the control level for each interrupt can be set by icr. ? the dtc can be activated by an interrupt request from an on-chip peripheral module. ? an interrupt request that activates the dtc is not affected by the interrupt control mode or the status of the cpu interrupt mask bits.
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 82 of 862 rej09b0429-0100 5.5 interrupt exception handling vector table table 5.3 lists interrupt exception handling sources, vector addresses, and interrupt priorities. for default priorities, the lower the vector number, the higher the prio rity. modules set at the same priority will conform to their default priorities. priorities within a module are fixed. an interrupt control level can be specified for a module to which an icr bit is assigned. interrupt requests from modules that are set to interrupt control level 1 (priority) by the icr bit setting are given priority and processed before interrupt requests from modules that are set to interrupt control level 0 (no priority). table 5.3 interrupt sources, vector addresses, and interrupt priorities vector address origin of interrupt source name vector number advanced mode icr priority nmi 7 h ' 00001c ? high external pin irq0 16 h ' 000040 icra7 irq1 17 h ' 000044 icra6 irq2 irq3 18 19 h ' 000048 h ' 00004c icra5 irq4 irq5 20 21 h ' 000050 h ' 000054 icra4 irq6 irq7 22 23 h ' 000058 h ' 00005c icra3 dtc swdtend (software activation data transfer end) 24 h ' 000060 icra2 wdt_0 wovi0 (interval timer) 25 h ' 000064 icra1 wdt_1 wovi1 (interval timer) 26 h ' 000068 icra0 ? address break 27 h ' 00006c ? a/d converter adi (a/d conversion end) 28 h ' 000070 icrb7 evc eventi 29 h ' 000074 ? tmr_x cmiax (compare match a) cmibx (compare match b) ovix (overflow) 44 45 46 h ' 0000b0 h ' 0000b4 h ' 0000b8 icrb4 frt ocia (output compare a) ocib (output compare b) fovi (overflow) 52 53 54 h ' 0000d0 h ' 0000d4 h ' 0000d8 icrb6 low
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 83 of 862 rej09b0429-0100 vector address origin of interrupt source name vector number advanced mode icr priority external pin irq8 irq9 irq10 irq11 56 57 58 59 h ' 0000e0 h ' 0000e4 h ' 0000e8 h ' 0000ec icrd7 high irq12 irq13 irq14 irq15 60 61 62 63 h ' 0000f0 h ' 0000f4 h ' 0000f8 h ' 0000fc icrd6 tmr_0 cmia0 (compare match a) cmib0 (compare match b) ovi0 (overflow) 64 65 66 h ' 000100 h ' 000104 h ' 000108 icrb3 tmr_1 cmia1 (compare match a) cmib1 (compare match b) ovi1 (overflow) 68 69 70 h ' 000110 h ' 000114 h ' 000118 icrb2 tmr_y cmiay (compare match a) cmiby (compare match b) oviy (overflow) 72 73 74 h ' 000120 h ' 000124 h ' 000128 icrb1 iic_2 iici2 76 h ' 000130 icrc2 iic_3 iici3 78 h ' 000138 sci_3 eri3 (reception error 3) rxi3 (reception completion 3) txi3 (transmission data empty 3) tei3 (transmission end 3) 80 81 82 83 h ' 000140 h ' 000144 h ' 000148 h ' 00014c icrc7 sci_1 eri1 (reception error 1) rxi1 (reception completion 1) txi1 (transmission data empty 1) tei1 (transmission end 1) 84 85 86 87 h ' 000150 h ' 000154 h ' 000158 h ' 00015c icrc6 scif scifi 92 h ' 000170 icrd1 iic_0 iici0 94 h ' 000178 icrc4 iic_1 iici1 98 h ' 000188 icrc3 iic_4 iici4 100 h ' 000190 icrb0 iic_5 iici5 102 h ' 000198 icrb0 lpc err1(transfer error, etc.) ibfi1 (idr1 reception completion) ibfi2 (idr2 reception completion) ibfi3 (idr3 reception completion) 104 105 106 107 h ' 0001a0 h ' 0001a4 h ' 0001a8 h 0001ac icrc1 low
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 84 of 862 rej09b0429-0100 5.6 interrupt control modes and interrupt operation the interrupt controller has two modes: interrupt control mode 0 and interrupt control mode 1. interrupt operations differ depending on the interrupt control mode. nmi interrupts and address break interrupts are always accepte d except for in reset state or in hardware standby mode. the interrupt control mode is selected by syscr. table 5.4 shows the interrupt control modes. table 5.4 interrupt control modes syscr interrupt control mode intm1 intm0 priority setting registers interrupt mask bits description 0 0 0 icr i interrupt mask control is performed by the i bit. priority levels can be set with icr. 1 1 icr i, ui 3-level interrupt mask control is performed by the i and ui bits. priority levels can be set with icr. figure 5.3 shows a block diagram of the priority decision circuit. icr ui i default priority determination vector number interrupt acceptance control and 3-level mask control interrupt source interrupt control modes 0 and 1 figure 5.3 block diagram of interrupt control operation
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 85 of 862 rej09b0429-0100 interrupt acceptance contro l and 3-leve l control: in interrupt control modes 0 and 1, interrupt acceptance control and 3-level mask control is performed by means of the i and ui bits in ccr and icr (control level). table 5.5 shows the interrupts select ed in each interrupt control mode. table 5.5 interrupts selected in each interrupt control mode interrupt mask bits interrupt control mode i ui selected interrupts 0 0 x all interrupts (interrupt control level 1 has priority) 1 x nmi and address break interrupts 1 0 x all interrupts (interrupt control level 1 has priority) 1 0 nmi, address break, and interrupt control level 1 interrupts 1 nmi and address break interrupts [legend] x : don?t care default priority determination: the priority is determined for the selected interrupt, and a vector number is generated. if the same value is set for icr, acceptance of multiple interrupts is enabled, and so only the interrupt source with the highest priority according to the preset default priorities is selected and has a vector number generated. interrupt sources with a lower priority than the accep ted interrupt source are held pending. table 5.6 shows operations and control signal functions in each interrupt control mode.
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 86 of 862 rej09b0429-0100 table 5.6 operations and control signal functions in each interrupt control mode interrupt setting interrupt acceptance control 3-level control default priority control mode intm1 intm0 i ui icr determination t (trace) 0 0 0 o im ? pr o ? 1 1 o im im pr o ? [legend] o: interrupt operation control performed im: used as an interrupt mask bit pr: sets priority ?: not used 5.6.1 interrupt control mode 0 in interrupt control mode 0, interrupts other than nmi are masked by icr and the i bit of the ccr in the cpu. figure 5.4 shows a flowchart of the interrupt acceptance operation. 1. if an interrupt source occurs when the corresponding interrupt enable bit is set to 1, an interrupt request is sent to the interrupt controller. 2. according to the interrupt control level speci fied in icr, the interrupt controller accepts an interrupt request with interrupt control level 1 (priority), and holds pending an interrupt request with interrupt control level 0 (no priority). if several interrupt requests are issued, an interrupt request with the highest priority is accepted acco rding to the priority order, an interrupt handling is requested to the cpu, and other interrupt requests are held pending. 3. if the i bit in ccr is set to 1, only nmi and address break interrupt requests are accepted by the interrupt controller, and other interrupt requests are held pending. if the i bit is cleared to 0, any interrupt request is accepted. kin, wue, a nd eventi interrupts are enabled or disabled by the i bit. 4. when the cpu accepts an interrupt request , it starts interrupt exception handling after execution of the current instruction has been completed. 5. the pc and ccr are saved to the stack area by interrupt exception handling. the pc saved on the stack shows the address of the first instruc tion to be executed after returning from the interrupt handling routine. 6. next, the i bit in ccr is set to 1. this masks all interrupts except for nmi and address break interrupts.
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 87 of 862 rej09b0429-0100 7. the cpu generates a vector address for th e accepted interrupt and st arts execution of the interrupt handling routine at the address indicated by the contents of the vector address in the vector table. program execution state interrupt generated? nmi an interrupt with interrupt control level 1? irq0 irq1 ibfi3 irq0 irq1 ibfi3 i = 0 save pc and ccr i 1 read vector address branch to interrupt handling routine yes no yes yes yes no no yes no yes no yes yes no no yes yes no pending figure 5.4 flowchart of procedure up to int errupt acceptance in interrupt control mode 0
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 88 of 862 rej09b0429-0100 5.6.2 interrupt control mode 1 in interrupt control mode 1, mask control is applied to three levels for irq and on-chip peripheral module interrupt requests by comparing the i and ui bits in ccr in the cp u, and the icr setting. ? an interrupt request with interrupt control level 0 is accepted when the i bit in ccr is cleared to 0. when the i bit is set to 1, the interrupt request is held pending. eventi, kin, and wue interrupts are enabled or disabled by the i bit. ? an interrupt request with interrupt control level 1 is accepted when the i bit or ui bit in ccr is cleared to 0. when both i and ui bits are set to 1, the interrupt request is held pending. for instance, the state when the interrupt enable bit corresponding to each interrupt is set to 1, and icra to icrd are set to h'20, h'00, h'00, and h'00, respectively (irq2 and irq3 interrupts are set to interrupt control level 1, and other interrupts are set to interrupt control level 0) is shown below. figure 5.6 shows a state transition diagram. ? all interrupt requests are accepted when i = 0. (priority order: nmi > irq2 > irq3 > irq0 > irq1 > address break ?) ? only nmi, irq2, irq3, and address break inte rrupt requests are accepted when i = 1 and ui = 0. ? only nmi and address break interrupt requests are accepted when i = 1 and ui = 1. only nmi and address break interrupt requests are accepted all interrupt requests are accepted exception handling execution or i 1, ui 1 i 0 i 1, ui 0 i 0ui 0 exception handling execution or ui 1 only nmi, address break, and interrupt control level 1 interrupt requests are accepted figure 5.5 state transition in interrupt control mode 1
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 89 of 862 rej09b0429-0100 figure 5.6 shows a flowchart of the interrupt acceptance operation. 1. if an interrupt source occurs when the corresponding interrupt enable bit is set to 1, an interrupt request is sent to the interrupt controller. 2. according to the interrupt control level speci fied in icr, the interr upt controller only accepts an interrupt request with interrupt control level 1 (priority), and holds pending an interrupt request with interrupt control level 0 (no priority). if several interrupt requests are issued, an interrupt request with the highe st priority is accepted according to the priority order, an interrupt handling is requested to the cpu, and other interrupt requests are held pending. 3. an interrupt request with interrupt control leve l 1 is accepted when the i b it is cleared to 0, or when the i bit is set to 1 while the ui bit is cleared to 0. an interrupt request with interrupt control level 0 is accepted when the i b it is cleared to 0. when both the i and ui bits are set to 1, only nmi and address break interrupt requests are accepted, and other interrupts are held pending. when the i bit is cleared to 0, the ui bit is not affected. 4. when the cpu accepts an interrupt request , it starts interrupt exception handling after execution of the current instru ction has been completed. 5. the pc and ccr are saved to the stack area by interrupt exception handling. the pc saved on the stack shows the address of the first instruc tion to be executed after returning from the interrupt handling routine. 6. the i and ui bits in ccr are set to 1. this masks all interrupts except for nmi and address break interrupts. 7. the cpu generates a vector address for th e accepted interrupt and st arts execution of the interrupt handling routine at the address indicated by the contents of the vector address in the vector table.
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 90 of 862 rej09b0429-0100 program execution state interrupt generated? nmi an interrupt with interrupt control level 1? irq0 irq1 ibfi3 irq0 irq1 ibfi3 ui = 0 save pc and ccr i 1, ui 1 read vector address branch to interrupt handling routine yes no yes yes yes no no yes no yes no yes yes no no yes yes no pending i = 0 i = 0 yes yes no no figure 5.6 flowchart of procedure up to interrupt acceptance in interrupt control mode 1
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 91 of 862 rej09b0429-0100 5.6.3 interrupt exception handling sequence figure 5.7 shows the interrupt exception handling sequence. the example shown is for the case where interrupt control mode 0 is set in advan ced mode, and the program area and stack area are in on-chip memory.
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 92 of 862 rej09b0429-0100 (14) (12) (10) (6) (4) (2) (1) (5) (7) (9) (11) (13) prefetch of instruction in interrupt-handling routine vector fetch stack access instruction prefetch internal processing internal processing interrupt is accepted interrupt level decision and wait for end of instruction interrupt request signal internal address bus internal read signal internal write signal internal data bus (3) (1) (2) (4) (3) (5) (7) instruction prefetch address (instruction is not executed. address is saved as pc contents, becoming return address.) instruction code (not executed) instruction prefetch address (instruction is not executed.) sp ? 2 sp ? 4 saved pc and ccr vector address starting address of interrupt-handling routine (contents of vector address) starting address of interrupt-handling routine ((13) = (10) (12)) first instruction in interrupt-handling routine (6) (8) (9) (11) (10) (12) (13) (14) (8) figure 5.7 interrupt exception handling
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 93 of 862 rej09b0429-0100 5.6.4 interrupt response times table 5.7 shows interrupt response times ? the intervals between generation of an interrupt request and execution of the first instruction in the interrupt handling routine. the execution status symbols used in table 5.7 are explained in table 5.8. table 5.7 interrupt response times no. execution status advanced mode 1 interrupt priority determination x 1 3 2 number of wait states until executing instruction ends * 2 1 to (19 + 2s i ) 3 pc, ccr stack save 2s k 4 vector fetch 2s i 5 instruction fetch * 3 2s i 6 internal processing * 4 2 total (using on-chip memory) 12 to 32 notes: 1. two states in case of internal interrupt. 2. refers to mulxs and divxs instructions. 3. prefetch after interrupt acceptance and prefetch of interrupt handling routine. 4. internal processing after interrupt acceptance and internal processing after vector fetch. table 5.8 number of states in interru pt handling routine execution status object of access external device 8-bit bus 16-bit bus symbol internal memory 2-state access 3-state access 2-state access 3-state access instruction fetch s i 1 4 6 + 2m 2 3 + m branch address read s j stack manipulation s k [legend] m: number of wait states in external device access.
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 94 of 862 rej09b0429-0100 5.6.5 dtc activation by interrupt the dtc can be activated by an interrupt. in this case, the following options are available: ? interrupt request to cpu ? activation request to dtc ? both of the above for details of interrupt requests that can be used to activate the dtc, see section 7, data transfer controller (dtc). figure 5.8 shows a block diagram of the dtc and interrupt controller. selection circuit dtcer dtvecr control logic determination of priority cpu dtc dtc activation request vector number clear signal cpu interrupt request vector number select signal interrupt request interrupt source clear signal irq interrupt on-chip peripheral module clear signal interrupt controller i, ui swdte clear signal figure 5.8 interrupt control for dtc the interrupt controller has three main functions in dtc control. (1) selection of interrupt source it is possible to select dtc activation request or cpu interrupt request with the dtce bit of dtcera to dtcere in the dtc. after a dtc data transfer, the dtce b it can be cleared to 0 and an interrupt request sent to the cpu in accord ance with the specificati on of the disel bit of mrb in the dtc. when the dtc pe rforms the specified number of da ta transfers and the transfer counter reaches 0, following the dtc data transfer the dtce bit is cleared to 0 and an interrupt request is sent to the cpu.
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 95 of 862 rej09b0429-0100 (2) determination of priority the dtc activation source is select ed in accordance with the defau lt priority order, and is not affected by mask or priority levels. see section 7.5, location of register information and dtc vector table, for the respective priorities. (3) operation order if the same interrupt is selected as a dtc activ ation source and a cpu interrupt source, the dtc data transfer is performed first, followed by cpu interrupt exception handling. table 5.9 summarizes interrupt source selection and interrupt source clearing control according to the settings of the dtce bit of dtcera to dt cere in the dtc and the disel bit of mrb in the dtc. table 5.9 interrupt source sel ection and clea ring control settings dtc interrupt source selection/clearing control dtce disel dtc cpu 0 x ? 1 0 ? 1 ? [legend] ? : the relevant interrupt is used. interrupt source clearing is performed. (the cpu should clear the source flag in the interrupt handling routine.) : the relevant interrupt is used. the interrupt source is not cleared. : the relevant interrupt cannot be used. x: don?t care
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 96 of 862 rej09b0429-0100 5.7 usage notes 5.7.1 conflict between interrupt generation and disabling when an interrupt enable bit is cleared to 0 to disable interrupt requests, the disabling becomes effective after execution of the in struction. when an interrupt enab le bit is cleared to 0 by an instruction such as bclr or mov, and if an interrupt is generated during execution of the instruction, the interrupt concerned will still be enabled on completion of the instruction, so interrupt exception handling for that interrupt will be executed on completion of the instruction. however, if there is an interrupt request of higher priority than that interrupt, interrupt exception handling will be executed for the higher-priority interrupt, and the lower-priority interrupt will be ignored. the same rule is also applied when an interrupt source flag is cleared to 0. figure 5.9 shows an example in which the cmiea bit in the tmr's tcr register is cleared to 0. the above conflict will not occur if an enable bit or interrupt source flag is cleared to 0 while the interrupt is masked. internal address bus internal write signal cmiea cmfa cmia interrupt signal tcr write cycle by cpu cmia exception handling tcr address figure 5.9 conflict between int errupt generation and disabling
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 97 of 862 rej09b0429-0100 5.7.2 instructions that disable interrupts the instructions that disable interrupts are ldc, andc, orc, and xorc. after any of these instructions are executed, all interrupts including nmi are disabled and the next instruction is always executed. when the i bit or ui bit is set by one of these instructions, the new value becomes valid two states after ex ecution of the instruction ends. 5.7.3 interrupts during execution of eepmov instruction interrupt operation differs between the eepmov.b instruction and the eepmov.w instruction. with the eepmov.b instruction, an interrupt request (including nmi) issued during the transfer is not accepted until the move is completed. with the eepmov.w instruction, if an interrupt request is issued during the transfer, interrupt exception handling starts at a break in the transfer cycle. the pc value saved on the stack in this case is the address of the next instruction. therefore, if an interrupt is generated during execution of an eepmov.w instruction, the following coding should be used. l1: eepmov.w mov.w r4,r4 bne l1 5.7.4 irq status registers (isr16, isr) since irqnf may be set to 1 according to the pi n status after a reset, the isr16 and the isr should be read after a reset, and then write 0 in irqnf (n = 15 to 0).
section 5 interrupt controller rev. 1.00 mar. 17, 2008 page 98 of 862 rej09b0429-0100
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 99 of 862 rej09b0429-0100 section 6 bus controller (bsc) this lsi has an on-chip bus controller (bsc) that manages the bus width and the number of access states of the external address space. the bsc also has a bus arbitration function, and controls the operation of the internal bus masters ? cpu and data transfer controller (dtc). 6.1 features ? extended modes two modes for external extension normal extended mode: normal extension (when admxe = 0 in syscr2 and obe = 0 in ptcnt0) glueless extension (when admxe = 0 in syscr2 and obe = 1 in ptcnt0) address-data multiplex extended mode: multiplex extension (when admxe = 1 in syscr2) ? extended area division possible in normal extended mode the external address space can be accessed as basic extended areas. a 256-kbyte extended area can be set and controlled independently of basic extended areas. ? address pin reduction in normal extended mode: a 256-kbyte extended area from h'f80000 to h'fbffff can be select ed using 18 address pins and the cs256 signal. a 2-kbyte area from h'fff000 to h'fff7ff can be se lected using six to eleven address pins and the ios signal. in address-data multiplex extended mode: the external address space can be accesse d as the following two extended areas. h'f80000 to h'f8ffff 64 kbyt es 256-kbyte extended area h'fff000 to h'fff7ff 2 kbytes ios extended area these areas can be selected using 8 pins or 16 pins, which is a total of address pins and data input/output pins. ? control address hold signal and area select signal polarity the output polarity of ios , cs256 , and ah can be inverted by the pnccs and pncah bits in lpwrcr
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 100 of 862 rej09b0429-0100 ? multiplex bus interface no wait inserted wait inserted address data address data 256-kbyte extended area 2 states * 2 states 2 states * (3 + wait) states ios extended area 2 states * 2 states 2 states * (3 + wait) states note: * a wait cycle is inserted by the setting of the wc22 bit. ? basic bus interface 2-state access or 3-state access can be selected for each area. program wait states can be inserted for each area. ? burst rom interface in normal extended mode a burst rom interface can be set for basic extended areas. 1-state access or 2-state access can be selected for burst access. ? idle cycle insertion in normal extended mode an idle cycle can be in serted for external write cycles imme diately after external read cycles. ? bus arbitration function includes a bus arbiter that arbitrates bus mastership between the cpu and dtc.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 101 of 862 rej09b0429-0100 bus controller external bus control signals [legend] bcr: bcr2: wscr: wscr2: bus control register bus control register 2 wait state control register wait state control register 2 internal control signals internal data bus wait controller bcr2 wscr2 bus mode signal bus arbiter dtc bus acknowledge signal cpu bus acknowledge signal dtc bus request signal cpu bus request signal bcr wscr wait figure 6.1 block diagram of bus controller
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 102 of 862 rej09b0429-0100 6.2 input/output pins table 6.1 summarizes the pin configuration of the bus controller. table 6.1 pin configuration symbol i/o function as output strobe signal indicating that address output on the address bus is enabled (when the iose bit in syscr is cleared to 0). note that this signal is not output when the 256-kbyte extended area is accessed (the cs256e bit in syscr is 1). ios output chip select signal indicating that the ios extended area is being accessed (when the iose bit in syscr is 1). cs256 output chip select signal indicating that the 256-kbyte extended area is being accessed (when the cs256e bit in syscr is 1). rd output strobe signal indicating that the external address space is being read. hwr output strobe signal indicating that the external address space is being written to, and the upper half (d15 to d8, ad15 to ad8) of the data bus is valid. lwr output strobe signal indicating that the external address space is being written to, and the lower half (d7 to d0, ad7 to ad0) of the data bus is valid. wait input wait request signal when accessing the external space. wr output strobe signal indicating that the external address space is being written to. hbe output strobe signal indicating that the external address space is being accessed, and the upper half (d15 to d8) of the data bus is valid. lbe output strobe signal indicating that the external address space is being accessed, and the lower half (d7 to d0) of the data bus is valid. ah output signal indicating address fetch timing when the bus is in address-data multiplex bus state. ad15 to ad0 input/output address output and data input/output pins for address-data multiplex extension.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 103 of 862 rej09b0429-0100 6.3 register descriptions the following registers are provided for the bus controller. for the system control register (syscr), see section 3.2.2, system control register (syscr). for port control register 0 (ptcnt0), see section 8.16.2, port control register 0 (ptcnt0). ? bus control register (bcr) ? bus control register 2 (bcr2) ? wait state control register (wscr) ? wait state control register 2 (wscr2) ? system control register 2 (syscr2) 6.3.1 bus control register (bcr) bcr is used to specify the access mode for the external address space and the i/o area range when the as / ios pin is specified as an i/o strobe pin. bit bit name initial value r/w description 7 ? 1 r/w reserved the initial value should not be changed. 6 icis 1 r/w idle cycle insertion selects whether or not to insert 1-state of the idle cycle between successive external read and external write cycles. 0: idle cycle not inserted 1: 1-state idle cycle inserted 5 brstrm 0 r/w valid only in the normal extended mode. burst rom enable selects the bus interface for the external address space. 0: basic bus interface 1: burst rom interface when the cs256e bit in syscr is set to 1, burst rom interface cannot be selected for the 256-kbyte extended area.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 104 of 862 rej09b0429-0100 bit bit name initial value r/w description 4 brsts1 1 r/w valid only in the normal extended mode. burst cycle select 1 selects the number of states in the burst cycle of the burst rom interface. 0: 1 state 1: 2 states 3 brsts0 0 r/w valid only in the normal extended mode. burst cycle select 0 selects the number of words that can be accessed by burst access via the burst rom interface. 0: max, 4 words 1: max, 8 words 2 ? 0 r/w reserved the initial value should not be changed. 1 0 ios1 ios0 1 1 r/w r/w ios select 1 and 0 select the address range where the ios signal is output. see table 6.12.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 105 of 862 rej09b0429-0100 6.3.2 bus control register 2 (bcr2) bcr2 is used to specify the ac cess mode for the extended area. bit bit name initial value r/w description 7, 6 ? all 0 r/w reserved the initial value should not be changed. 5, 4 ? all 1 r/w reserved the initial value should not be changed. 3 adfulle 0 r/w address output full enable controls the address output, a23 to a21, in access to the extended area. see section 8, i/o ports. this is not supported while admxe = 1. 2 excks 0 r/w external extension clock select selects the operating clock used in external extended area access. 0: medium-speed clock is selected as the operating clock 1: system clock ( ) is selected as the operating clock. the operating clock is switched in the bus cycle prior to external extended area access. 1 ? 1 r/w reserved the initial value should not be changed. 0 ? 0 r/w reserved the initial value should not be changed.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 106 of 862 rej09b0429-0100 6.3.3 wait state control register (wscr) wscr is used to specify the data bus width, the number of access states, the wait mode, and the number of wait states for access to external a ddress spaces (basic extended area and 256-kbyte extended area). the bus width and the number of acce ss states for internal memory and internal i/o registers are fixed regardless of the wscr settings. bit bit name initial value r/w description 7 abw256 1 r/w 256-kbyte extended area bus width control selects the bus width for access to the 256-kbyte extended area when the cs256e bit in syscr is set to 1. 0: 16-bit bus 1: 8-bit bus 6 ast256 1 r/w 256-kbyte extended area access state control selects the number of states for access to the 256-kbyte extended area when the cs256e bit in syscr is set to 1. this bit also enables or disables wait-state insertion. [admxe = 0] normal extension 0: 2-state access space. wait state insertion disabled 1: 3-state access space. wait state insertion enabled [admxe = 1] address-data multiplex extension 0: 2-state data access space. wait state insertion disabled 1: 3-state data access space. wait state insertion enabled 5 abw 1 r/w basic extended area bus width control selects the bus width for access to the basic extended area. 0: 16-bit bus 1: 8-bit bus when the cs256e bit in syscr is set to 1, this bit setting is ignored in access to the 256-kbyte extended area.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 107 of 862 rej09b0429-0100 bit bit name initial value r/w description 4 ast 1 r/w basic extended area access state control selects the number of states for access to the basic extended area. this bit also enables or disables wait- state insertion. [admxe = 0] normal extension 0: 2-state access space. wait state insertion disabled 1: 3-state access space. wait state insertion enabled [admxe = 1] address-data multiplex extension 0: 2-state data access space. wait state insertion disabled 1: 3-state data access space. wait state insertion enabled when the cs256e bit in syscr is set to 1, this bit setting is ignored in access to the 256-kbyte extended area. 3 2 wms1 wms0 0 0 r/w r/w basic extended area wait mode select 1 and 0 selects the wait mode for access to the basic extended area when the ast bit is set to 1. 00: program wait mode 01: wait disabled mode 10: pin wait mode 11: pin auto-wait mode when the cs256e bit in syscr is set to 1, this bit setting is ignored in access to the 256-kbyte extended area. 1 0 wc1 wc0 1 1 r/w r/w basic extended area wait count 1 and 0 selects the number of program wait states to be inserted when the basic extended area is accessed when the ast bit is set to 1. the program wait state is only inserted into data cycles. 00: program wait state is not inserted 01: 1 program wait state is inserted 10: 2 program wait states are inserted 11: 3 program wait states are inserted when the cs256e bit in syscr is set to 1, this bit setting is ignored in access to the 256-kbyte extended area.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 108 of 862 rej09b0429-0100 6.3.4 wait state control register 2 (wscr2) wscr2 is used to specify the wait mode and number of wait states in access to the 256-kbyte extended area. bit bit name initial value r/w description 7 wms10 0 r/w 256-kbyte extended area wait mode select 0 selects the wait mode for access to the 256-kbyte extended area when the cs256e bit in syscr and the ast256 bit in wscr are set to 1. 0: program wait mode 1: wait disabled mode 6 5 wc11 wc10 1 1 r/w r/w 256-kbyte extended area wait count 1 and 0 selects the number of program wait states to be inserted into the data cycle for access to the 256-kbyte extended area when the cs256e bit in syscr and the ast256 bit in wscr are set to 1. 00: program wait state is not inserted 01: 1 program wait state is inserted 10: 2 program wait states are inserted 11: 3 program wait states are inserted 4 3 ? all 0 r/w reserved
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 109 of 862 rej09b0429-0100 ? when admxe = 0 bit bit name initial value r/w description 2 to 0 ? all 1 r/w reserved ? when admxe = 1 bit bit name initial value r/w description 2 wc22 1 r/w address-data multiplex extended area address cycle wait count 2 selects the number of program wait states to be inserted into the address cycle for access to the address-data multiplex extended area. 0: program wait state is not inserted 1: 1 program wait state is inserted in the address cycle 1, 0 ? all 1 r/w reserved 6.3.5 system control register 2 (syscr2) syscr2 controls the address-data multiplex operation. bit bit name initial value r/w description 7 to 4 ? all 0 r/w reserved the initial value should not be changed. 3 admxe 0 r/w address-data multiplex bus interface enable 0: normal extended bus interface 1: address data multiplex extended bus interface 2 to 0 ? all 0 r/w reserved the initial value should not be changed.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 110 of 862 rej09b0429-0100 6.4 bus control 6.4.1 bus specifications the external address space bus specifications consis t of three elements: bus width, the number of access states, and the wait mode and the number of program wait states. the bus width and the number of access states for on-chip memory and in ternal i/o registers are fixed, and are not affected by the bus controller settings. (1) in normal extended mode (a) bus width a bus width of 8 or 16 bits can be selected via the abw and abw256 bits in wscr. (b) number of access states two or three access states can be selected via the ast and ast256 bits in wscr. when the 2- state access space is designated, wait-state insertion is disabled. in the burst rom interface, the number of access st ates for the basic extended area is determined regardless of the ast bit setting. (c) wait mode and number of program wait states when the basic extended area is specified as a 3-state access space by the ast bit in wscr, the wait mode and the number of program wait states to be inserted automatically is selected by the wms1, wms0, wc1, and wc0 bits in wscr. from 0 to 3 program wait states can be selected. when the 256-kbyte extended area is specified as a 3-state access space by the ast256 bit in wscr, the wait mode and the number of program wait states to be inserted automatically is selected by the wms10, wc11, and wc10 bits in wscr2. from 0 to 3 program wait states can be selected. the wait function for external extension is eff ective for connecting low-speed devices to the external address space. however, this wait function may cause some problems when the operation of bus masters other than the cpu, such as the dtc are to be delayed. tables 6.2 to 6.5 show each bit setting and external address space division in the address ranges of the external address space, and the bus specifica tions for the basic bus interface of each area.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 111 of 862 rej09b0429-0100 (d) glueless extension setting the obe bit in ptcnt0 selects glueless extension, which uses the rd , wr , hbe , and lbe signals to allow connection to the external space without a dding an external circuit. table 6.2 address ranges a nd external address spaces area address range basic extended area 256-kbyte extended area h'080000 to h'f7ffff (15 mbytes) : no condition ? h'f80000 to h'fbffff (256 kbytes) 256-kbyte extended area ? : when cs256e = 0, used as basic extended area. when wait pin function is not selected while cs256e = 1, cs256 is output and address pins a17 to a0 are used. h'fc0000 to h'feffff (192 kbytes) : no condition ? h'ff0800 to h'ffbfff (46 kbytes) ? : when rame = 0, used as basic extended area. ? h'ffc000 to h'ffdfff (8 kbytes) : no condition ? h'ffe000 to h'ffe07f (128 bytes) : no condition. ? h'ffe080 to h'ffefff (3968 bytes) ? : when rame = 0, used as basic extended area. ? h'fff000 to h'fff7ff (2 kbytes) no condition when iose = 1, ios is output and address pins a10 to a0 are used. ? h'ffff00 to h'ffff7f (128 bytes) ? when rame = 0, used as basic extended area. ? [legend] : this address range is unconditionally accessed as the basic extended area. ? : condition for making this address range accessed as the basic extended area. ? : this address range cannot be used as part of a 256-kbyte extended area.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 112 of 862 rej09b0429-0100 table 6.3 bit settings and bus speci fications of basic bus interface areas brstrm cs256e basic extended area 256-kbyte extended area 0 used as basic extended area 0 1 basic extended area abw, ast, wms1, wms0, wc1, wc0 abw256, ast256, wms10, wc11, wc10 0 used as burst rom interface 1 1 burst rom interface * abw, ast, wms0, wc1, wc0, brsts1, brsts0 abw256, ast256, wms10, wc11, wc10 note: * in the burst rom interface, the bus width is specified by the abw bit in wscr, the number of full access states (wait can be inserted) is specified by the ast bit in wscr, and the number of access cycles in burst access is specified regardless of the ast bit setting. table 6.4 bus specificati ons for basic extended area/basic bus interface bus specifications abw ast wms1 wms0 wc1 wc0 bus width number of access states number of program wait states 0 x x x x 16 2 0 0 1 x x 3 0 0 0 0 1 1 0 2 0 1 other than wms1 = 0 and wms0 = 1 1 1 16 3 3 0 x x x x 8 2 0 0 1 x x 3 0 0 0 0 1 1 0 2 1 1 other than wms1 = 0 and wms0 = 1 1 1 8 3 3 [legend] x: don't care
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 113 of 862 rej09b0429-0100 table 6.5 bus specifications for 256-kbyte extended area/basic bus interface bus specifications abw256 ast256 wms10 wc11 wc10 bus width number of access states number of program wait states 0 x x x 16 2 0 1 x x 3 0 0 0 0 1 1 0 2 0 1 0 1 1 16 3 3 0 x x x 8 2 0 1 x x 3 0 0 0 0 1 1 0 2 1 1 0 1 1 8 3 3 [legend] x: don't care
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 114 of 862 rej09b0429-0100 (2) in address-data multiplex extended mode (a) bus width a bus width of 8 or 16 bits can be selected via the abw and abw256 bits in wscr. (b) number of access states two or three states can be selected for data access via the ast and ast256 bits in wscr. when the 2-state access space is designated, wait-state insertion is disabled. (c) wait mode and number of program wait states ? ios extended area when the ios extended area is specified as a 3-state access space by the ast bit in wscr, the wait mode and the number of program wait states to be inserted automatically is selected by the wms1, wms0, wc1, and wc0 bits in wscr. zero or one program wait state can be inserted into address cy cle. from zero to three program wait states can be selected for data cycle. ? 256-kbyte extended area when the 256-kbyte extended area is specified as a 3-state access space by the ast256 bit in wscr, the wait mode and the number of program wait states to be inserted automatically is selected by the wms10, wc11, and wc10 bits in wscr2. zero or one program wait state can be inserted into address cy cle. from zero to three program wait states can be selected for data cycle. the wait function for external extension is eff ective for connecting low-speed devices to the external address space. however, this wait function may cause some problems when the operation of bus masters other than the cpu, such as the dtc, are to be delayed. tables 6.6 to 6.11 show address-data multiplex address space and the bus specifications for the basic bus interface of each area.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 115 of 862 rej09b0429-0100 table 6.6 address-data multiplex address spaces address range address-data multiplex area h'080000 to h'f7ffff (15 mbytes) ? no condition 256-kbyte extended area h'f80000 to h'f8ffff (64 kbytes) o when the wait pin function is not selected and cs256e = 1, cs256 is output and address ad15 to ad0 or ad7 to ad0 are used. 256-kbyte extended area h'f90000 to h'f9ffff (64 kbytes) ? no condition 256-kbyte extended area h'fa0000 to h'faffff (64 kbytes) ? no condition 256-kbyte extended area h'fb0000 to h'fbffff (64 kbytes) ? no condition h'fc0000 to h'ffbfff (240 kbytes) ? no condition h'ffc000 to h'ffdfff (8 kbytes) ? no condition h'ffe000 to h'ffefff (4 kbytes) ? no condition ios extended area h'fff000 to h'fff7ff (2 kbytes) o when iose = 1, ios is output and address pins ad15 to ad0 or ad7 to ad0 are used. h'ffff00 to h'ffff7f (128 bytes) ? no condition [legend] ? : this address range cannot be used as the address-data multiplex address space. o: condition for making this address range accessed as the address-data multiplex address space.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 116 of 862 rej09b0429-0100 table 6.7 bit settings and bus speci fications of basic bus interface area iose cs256e ios extended area 256-kbyte extended area 1 0 ? 1 abw, ast, wms1, wms0, wc1, wc0 abw256, ast256, wms10, wc11, wc10 0 0 ? 1 ? abw256, ast256, wms10, wc11, wc10 table 6.8 bus specifications for ios extende d area/multiplex bus interface (address cycle) ast wms1 wms0 wc22 wc1 wc0 number of access states number of program wait states 0 ? ? 0 ? ? ? 1 ? ? 2 1 table 6.9 bus specifications for ios extended area/multiplex bus in terface (data cycle) ast wms1 wms0 wc1 wc0 number of access states number of program wait states 0 ? ? ? ? 2 0 0 1 ? ? 3 0 0 3 0 0 1 1 0 2 1 other than wms1 = 0 and wms0 = 1 1 1 3
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 117 of 862 rej09b0429-0100 table 6.10 bus specifications for 256-kbyte extended area/multiplex bus interface (address cycle) ast256 wms10 wc22 wc11 wc10 number of access states number of program wait states 0 ? ? 0 ? ? 1 ? ? 2 1 table 6.11 bus specifications for 256-kbyte extended area/multiplex bus interface (data cycle) ast256 wms1 wc1 wc0 number of access states number of program wait states 0 ? ? ? 2 0 1 ? ? 3 0 0 3 0 0 1 1 0 2 1 0 1 1 3 6.4.2 advanced mode the external address space (h'fff000 to h'fff7ff) can be accessed by specifying the as / ios pin as an i/o strobe pin. the 256-kbyte extended area (h'f80000 to h'fbffff) can be accessed by the cs256 pin function. the external address space is initialized as the basic bus interface and a 3-state access space. in mode 2, the address space other than on-chip rom, on-chip ram, internal i/o registers, and their reserved areas is specified as the external address space. the on- chip ram and its reserved area are enabled when the rame bit in syscr is set to 1, and disabled when the rame bit is cleared to 0. addresses h'ff0800 to h'ffbfff, h'ffe080 to h'ffefff, and h'ffff00 to h'ffff7f in the on-chip ram area and its reserved area are al ways specified as the external address space.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 118 of 862 rej09b0429-0100 6.4.3 i/o select signals the lsi can output i/o select signals ( ios ); the signal is driven low when the corresponding external address space is accessed. figure 6.2 shows an example of ios signal output timing. bus cycle t 1 t 2 address bus ios t 3 external addresses selected by ios figure 6.2 ios signal output timing enabling or disabling ios signal output is performed by the iose bit in syscr. in the extended mode, the ios pin functions as an as pin by a reset. to use this pin as an ios pin, set the iose bit to 1. for details, see section 8, i/o ports. the address ranges of the ios signal output can be specified by the ios1 and ios0 bits in bcr, as shown in table 6.12. table 6.12 address range for ios signal output ios1 ios0 ios signal output range 0 h'fff000 to h'fff03f 0 1 h'fff000 to h'fff0ff 0 h'fff000 to h'fff3ff 1 1 h'fff000 to h'fff7ff (initial value)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 119 of 862 rej09b0429-0100 6.5 bus interface the normal extended bus interface enables direct connection to rom and sram. for details on selection of the bus specifications for the basic extended area and 256-kbyte extended area, see tables 6.4 to 6.5. the address-data multiplex extended bus interface enables direct connection to products that supports this bus interface. for details on selection of the bus specifications for the ios extended area and 256-kbyte extended area, see tables 6.9 to 6.14. 6.5.1 data size and data alignment data sizes for the cpu and other internal bus masters are byte, word, and longword. the bsc has a data alignment function, and controls whether the upper data bus (d15 to d8/ad15 to ad8) or lower data bus (d7 to d0/ad7 to ad0) is used when the external address space is accessed, according to the bus specificati ons for the area being accessed (8-bit access space or 16-bit access space) and the data size. (1) 8-bit access space figure 6.3 illustrates data alignment control for the 8-bit access space. with the 8-bit access space, the upper data bus (d15 to d8) is always used for accesses. the amount of data that can be accessed at one time is one byte: a word access is performed as two byte accesses, and a longword access, as four byte accesses. the lower data bus (ad7 to ad0) is used in address-data multiplex extended mode. d15 d8 d7 d0 upper data bus lower data bus byte size word size 1st bus cycle 2nd bus cycle longword size 1st bus cycle 2nd bus cycle 3rd bus cycle 4th bus cycle 70 8 15 0 7 24 31 16 23 8 15 0 7 figure 6.3 access sizes and data a lignment control (8-b it access space)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 120 of 862 rej09b0429-0100 (2) 16-bit access space figure 6.4 illustrates data alignment control for the 16-bit access space. with the 16-bit access space, the upper data bus (d15 to d8/ad15 to ad8) and lower data bus (d7 to d0/ad7 to ad0) are used for accesses. the amount of data that ca n be accessed at one time is one byte or one word, and a longword access is executed as two word accesses. in byte access, whether the upper or lower data bus is used is determined by whether the address is even or odd. the upper data bus is used for even addresses, and the lower data bus for odd addresses. d15 d8 d7 d0 upper data bus lower data bus byte size word size 1st bus cycle 2nd bus cycle longword size even address byte size odd address 8 15 0 7 0 7 8 15 24 31 8 15 16 23 0 7 figure 6.4 access sizes and data a lignment control ( 16-bit access space)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 121 of 862 rej09b0429-0100 6.5.2 valid strobes table 6.13 shows the data buses used and valid strobes for each access space. in a read, the rd signal is valid for both the upper and lower halves of the data bus. in a write, the hwr signal is valid for the upper half of the data bus, and the lwr signal for the lower half. table 6.13 data buses used and valid strobes area access size read/ write address valid strobe upper data bus (d15 to d8/ ad15 to ad8) lower data bus (d7 to d0/ad7 to ad0) read ? rd ports or others 8-bit access space byte write ? hwr valid ports or others read ? rd 8-bit access space (in address- data multiplex extended mode) byte write ? hwr ports or others valid even valid invalid read odd rd invalid valid even hwr valid undefined byte write odd lwr undefined valid read ? rd valid valid 16-bit access space word write ? hwr , lwr valid valid [legend] undefined: undefined data is output. invalid: input state with the input value ignored. ports or others: used as ports or i/o pins for on-chip peripheral modules, and are not used as the data bus.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 122 of 862 rej09b0429-0100 6.5.3 valid strobes (in glueless extension) table 6.14 shows the data buses used and valid strobes for each access space. the rd and wr signals are valid for both the upper and lower halves of the data bus. in a write, the hbe signal is valid for the upper half of the data bus, and the lbe signal for the lower half. table 6.14 data buses used and valid strobes (gluless extension) area access size read/ write address valid strobe upper data bus (d15 to d8) lower data bus (d7 to d0) read ? rd 8-bit access space byte write ? wr valid ports or others even rd , hbe valid invalid read odd rd , lbe invalid valid even wr , hbe valid undefined byte write odd wr , lbe undefined valid read ? rd , hbe , lbe 16-bit access space word write ? wr , hbe , lbe valid valid [legend] undefined: undefined data is output. invalid: input state with the input value ignored. ports or others: used as ports or i/o pins for on-chip peripheral modules, and are not used as the data bus.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 123 of 862 rej09b0429-0100 6.5.4 basic operation timing in normal extended mode (1) 8-bit, 2-state access space figure 6.5 shows the bus timing for an 8-bit, 2-state access space. when an 8-bit access space is accessed, the upper half (d15 to d8) of the data bus is used. wait states cannot be inserted. bus cycle t 1 t 2 address bus (iose = 1) cs256 (cs256e = 1) as (iose = 0) rd d15 to d8 valid d7 to d0 invalid read * hwr d15 to d8 valid write note: * for external address space access, this signal is not output when the 256-kbyte extended area is accessed with cs256e = 1. figure 6.5 bus timing for 8-bit, 2-state access space
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 124 of 862 rej09b0429-0100 (2) 8-bit, 3-state access space figure 6.6 shows the bus timing for an 8-bit, 3-state access space. when an 8-bit access space is accessed, the upper half (d15 to d8) of the data bus is used. wait states can be inserted. bus cycle t 1 t 2 address bus as (iose = 0) rd d15 to d8 valid d7 to d0 invalid read hwr d15 to d8 valid write t 3 ios (iose = 1) cs256 (cs256e = 1) note: * * for external address space access, this signal is not output when the 256-kbyte extended area is accessed with cs256e = 1. figure 6.6 bus timing for 8-bit, 3-state access space
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 125 of 862 rej09b0429-0100 (3) 16-bit, 2-state access space figures 6.7 to 6.9 show bus timings for a 16-bit, 2-state access space. when a 16-bit access space is accessed, the upper half (d15 to d8) of the data bus is used for even addresses, and the lower half (d7 to d0) for odd addresses. wait states cannot be inserted. bus cycle t 1 t 2 address bus (iose = 0) rd d15 to d8 valid d7 to d0 invalid read hwr lwr d15 to d8 valid d7 to d0 undefined write high level ios (iose = 1) cs256 (cs256e = 1) * note: * for external address space access, this signal is not output when the 256-kbyte extended area is accessed with cs256e = 1. figure 6.7 bus timing for 16-bit, 2-state access space (even byte access)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 126 of 862 rej09b0429-0100 bus cycle t 1 t 2 address bus as (iose = 0) rd d15 to d8 invalid d7 to d0 valid read * hwr lwr d15 to d8 undefined d7 to d0 valid write high level ios (iose = 1) cs256 (cs256e = 1) note: * for external address space access, this signal is not output when the 256-kbyte extended area is accessed with cs256e = 1. figure 6.8 bus timing for 16-bit, 2-state access space (odd byte access)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 127 of 862 rej09b0429-0100 bus cycle t 1 t 2 address bus as (iose = 0) rd d15 to d8 valid d7 to d0 valid read * hwr lwr d15 to d8 valid d7 to d0 valid write ios (iose = 1) cs256 (cs256e = 1) note: * for external address space access, this signal is not output when the 256-kbyte extended area is accessed with cs256e = 1. figure 6.9 bus timing for 16-bit, 2-state access space (word access)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 128 of 862 rej09b0429-0100 (4) 16-bit, 3-state access space figures 6.10 to 6.12 show bus timings for a 16-bit, 3-state access space. when a 16-bit access space is accessed, the upper half (d15 to d8) of the data bus is used for even addresses, and the lower half (d7 to d0) for odd addresses. wait states can be inserted. bus cycle t 1 t 2 address bus as (iose = 0) rd d15 to d8 valid d7 to d0 invalid read * hwr lwr d15 to d8 valid d7 to d0 undefined write high level t 3 ios (iose = 1) cs256 (cs256e = 1) note: * for external address space access, this signal is not output when the 256-kbyte extended area is accessed with cs256e = 1. figure 6.10 bus timing for 16-bit, 3-state access space (even byte access)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 129 of 862 rej09b0429-0100 bus cycle t 1 t 2 address bus as (iose = 0) rd d15 to d8 invalid d7 to d0 valid read * hwr lwr d15 to d8 undefined d7 to d0 valid write high level t 3 ios (iose = 1) cs256 (cs256e = 1) note: * for external address space access, this signal is not output when the 256-kbyte extended area is accessed with cs256e = 1. figure 6.11 bus timing for 16-bit, 3-state access space (odd byte access)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 130 of 862 rej09b0429-0100 bus cycle t 1 t 2 address bus as (iose = 0) rd d15 to d8 valid d7 to d0 valid read * hwr lwr d15 to d8 valid d7 to d0 valid write t 3 ios (iose = 1) cs256 (cs256e = 1) note: * for external address space access, this signal is not output when the 256-kbyte extended area is accessed with cs256e = 1. figure 6.12 bus timing for 16-bit, 3-state access space (word access)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 131 of 862 rej09b0429-0100 bus cycle address bus (a23 to a0) cs ios (iose = 1) cs256 (cs256e = 1) valid as * rd wr hbe lbe d15 to d8 invalid d7 to d0 d15 to d8 d7 to d0 even valid undefined * for external address space access, this signal is not output when the 256-kbyte extended area is accessed with cs256e = 1. note: read write high level figure 6.13 glueless extension even byte access (admxe = 0)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 132 of 862 rej09b0429-0100 bus cycle address bus (a23 to a0) cs ios (iose = 1) cs256 (cs256e = 1) invalid as * rd wr hbe lbe d15 to d8 valid d7 to d0 d15 to d8 d7 to d0 odd undefined * for external address space access, this signal is not output when the 256-kbyte extended area is accessed with cs256e = 1. note: read write valid high level figure 6.14 glueless extension odd byte access (admxe = 0)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 133 of 862 rej09b0429-0100 bus cycle address bus (a23 to a0) cs ios (iose = 1) cs256 (cs256e = 1) valid as * rd wr hbe lbe d15 to d8 valid d7 to d0 d15 to d8 d7 to d0 even valid * for external address space access, this signal is not output when the 256-kbyte extended area is accessed with cs256e = 1. note: read write valid figure 6.15 glueless extension word access (admxe = 0)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 134 of 862 rej09b0429-0100 6.5.5 basic operation timing in address-data multiplex extended mode (1) 8-bit, 2-state data access space figures 6.16 and 6.17 show the bus timing for an 8-bit, 2-state access space. when an 8-bit access space is accessed, the lower half (ad7 to ad0) of the data bus is used. wait states cannot be inserted. read cycle address data data address data write cycle t 1 t 2 t 3 t aw t 4 t 1 t 2 t 3 t aw t 4 cs256 ios ah rd hwr ad7 to ad0 address address data figure 6.16 bus timing for 8-bit, 2-state access space
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 135 of 862 rej09b0429-0100 read cycle address data address data write cycle t 1 t 2 t 3 t 4 t 1 t 2 t 3 t 4 cs256 ios ah rd hwr ad7 to ad0 address address data data figure 6.17 bus timing for 8-bit, 2-state access space (2) 8-bit, 3-state data access space figure 6.18 shows the bus timing for an 8-bit, 3-state access space. when an 8-bit access space is accessed, the lower half (ad7 to ad0) of the da ta bus is used. wait states can be inserted. read cycle address data data data write cycle t 1 t 2 t 3 t aw t 5 t dsw t 4 t 1 t 2 t 3 t aw t 5 t dsw t 4 address cs256 ios ah rd hwr ad7 to ad0 address address data figure 6.18 bus timing for 8-bit, 3-state access space
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 136 of 862 rej09b0429-0100 (3) 16-bit, 2-state data access space figures 6.19 to 6.24 show bus timings for a 16-bit, 2-state access space. when a 16-bit access space is accessed, the upper half (ad15 to ad8) of th e data bus is used for even addresses, and the lower half (ad7 to ad0) for odd addresses. wait states cannot be inserted. read cycle address data data write cycle t 1 t 2 t 3 t aw t 4 address t 1 t 2 t 3 t aw t 4 cs256 ios ah rd hwr lwr ad15 to ad8 ad7 to ad0 address address data data address address figure 6.19 bus timing for 16-bit, 2-state access space (1) (even byte access)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 137 of 862 rej09b0429-0100 read cycle address data address data write cycle t 1 t 2 t 3 t 4 t 1 t 2 t 3 t 4 cs256 ios ah rd hwr lwr ad15 to ad8 ad7 to ad0 address address data data address address figure 6.20 bus timing for 16-bit, 2-state access space (2) (even byte access) read cycle address data data write cycle t 1 t 2 t 3 t aw t 4 address t 1 t 2 t 3 t aw t 4 cs256 ios ah rd hwr lwr ad15 to ad8 ad7 to ad0 address address data data address address figure 6.21 bus timing for 16-bit, 2- state access space (3) (odd byte access)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 138 of 862 rej09b0429-0100 read cycle address data address data write cycle t 1 t 2 t 3 t 4 t 1 t 2 t 3 t 4 cs256 ios ah rd hwr lwr ad15 to ad8 ad7 to ad0 ck2s address address data data address address figure 6.22 bus timing for 16-bit, 2- state access space (4) (odd byte access)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 139 of 862 rej09b0429-0100 read cycle address data data write cycle t 1 t 2 t 3 t aw t 4 address t 1 t 2 t 3 t aw t 4 cs256 ios ah rd hwr lwr ad15 to ad8 ad7 to ad0 address address data data data data address address figure 6.23 bus timing for 16-bit, 2-state access space (5) (word access) read cycle address data address data write cycle t 1 t 2 t 3 t 4 t 1 t 2 t 3 t 4 cp256 ios ah rd hwr lwr ad15 to ad8 ad7 to ad0 address address data data data data address address figure 6.24 bus timing for 16-bit, 2-state access space (6) (word access)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 140 of 862 rej09b0429-0100 (4) 16-bit, 3-state data access space figures 6.25 to 6.27 show bus timings for a 16-bit, 3-state access space. when a 16-bit access space is accessed, the upper half (ad15 to ad8) of th e data bus is used for even addresses, and the lower half (ad7 to ad0) for odd addresses. wait states can be inserted. read cycle address data data write cycle t 1 t 2 t 3 t aw t 5 t dsw t 4 t 1 t 2 t 3 t aw t 5 t dsw t 4 address cs256 ios ah rd hwr lwr ad7 to ad0 ad15 to ad8 address address address address data data figure 6.25 bus timing for 16-bit, 3-state access space (1) (even byte access)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 141 of 862 rej09b0429-0100 read cycle address data data write cycle t 1 t 2 t 3 t aw t 5 t dsw t 4 t 1 t 2 t 3 t aw t 5 t dsw t 4 address cs256 ios ah rd hwr lwr ad7 to ad0 ad15 to ad8 address address address address data data figure 6.26 bus timing for 16-bit, 3- state access space (2) (odd byte access) read cycle address data data write cycle t 1 t 2 t 3 t aw t 5 t dsw t 4 t 1 t 2 t 3 t aw t 5 t dsw t 4 address cs256 ios ah rd hwr lwr ad7 to ad0 data data ad15 to ad8 address address address address data data figure 6.27 bus timing for 16-bit, 3-state access space (3) (word access)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 142 of 862 rej09b0429-0100 6.5.6 wait control when accessing the external address space, this ls i can extend the bus cycle by inserting one or more wait states (t w ). there are three ways of inserting wait states: program wait insertion, pin wait insertion using the wait pin, and the combination of program wait and the wait pin. (1) in normal extended mode (a) program wait mode a specified number of wait states t w are always inserted between the t 2 state and t 3 state when accessing the external address space. the number of wait states t w is specified by the settings of the wc1 and wc0 bits in wscr (the wc11 and wc10 bits in wscr2 for the 256-kbyte extended area). (b) pin wait mode a specified number of wait states t w are always inserted between the t 2 state and t 3 state when accessing the external address space. the number of wait states t w is specified by the settings of the wc1 and wc0 bits. if the wait pin is low at the falling edge of in the last t 2 or t w state, another t w state is inserted. if the wait pin is held low, t w states are inserted until it goes high. pin wait mode is useful when inserting four or more t w states, or when changing the number of t w states to be inserted for each external device. (c) pin auto-wait mode a specified number of wait states t w are inserted between the t 2 state and t 3 state when accessing the external address space if the wait pin is low at the falling edge of in the last t 2 state. the number of wait states t w is specified by the settings of the wc1 and wc0 bits. even if the wait pin is held low, t w states are inserted only up to the specified number of states. pin auto-wait mode enables the low-speed memory interface only by inputting the chip select signal to the wait pin. figure 6.28 shows an example of wait state insertion timing in pin wait mode. the settings after a reset are: 3-state access, 3 program wait insertion, and wait pin input disabled.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 143 of 862 rej09b0429-0100 by program wait t 1 address bus as (iose = 0) rd data bus read data read * ios (iose = 1) wr write data write note: shown in clock indicates the wait pin sampling timing. wait data bus t 2 t w t w t w t 3 by wait pin * for external address space access, this signal is not output when the 256-kbyte extended area is accessed with cs256e = 1. figure 6.28 example of wait state insertion timing (pin wait mode)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 144 of 862 rej09b0429-0100 (2) in address-data multiplex extended mode (a) program wait mode program wait mode includes address wait and data wait. ? 256-kbyte extended area and ios extended area zero or one state of address wait t aw is inserted between t 1 and t 2 states. zero to three states of data wait t dsw is inserted between t 4 and t 5 states. (b) pin wait mode when accessing the external address space, a specified number of wait states t dsw can be inserted between the t 4 state and t 5 state of data state. the number of wait states t dsw is specified by the settings of the wc1 and wc0 bits. if the wait pin is low at the falling edge of in the last t 4 , t dsw , or t dow state, another t dow state is inserted. if the wait pin is held low, t dow states are inserted until it goes high. pin wait mode is useful when inserting four or more t dow states, or when changing the number of t dow states to be inserted for each external device. (c) pin auto-wait mode a specified number of wait states t dow are inserted between the t 4 state and t 5 state when accessing the external address space if the wait pin is low at the falling edge of in the last t 4 state. the number of wait states t dow is specified by the settings of the wc1 and wc0 bits. even if the wait pin is held low, t dow states are inserted only up to the specified number of states. pin auto-wait mode enables the low-speed memory interface only by inputting the chip select signal to the wait pin. figure 6.29 shows an example of wait state insertion timing in pin wait mode.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 145 of 862 rej09b0429-0100 read cycle data data write cycle t 5 t dsw t dow t dow t 3 t 4 t 5 t dsw t dow t dow t 3 t 4 cs256 ios wait ah rd hwr lwr ad7 to ad0 data data ad15 to ad8 data data figure 6.29 example of wait state insertion timing
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 146 of 862 rej09b0429-0100 6.6 burst rom interface in this lsi, the external ad dress space can be designated as the burst rom space by the brstrm bit in bcr, and the burst rom in terface enabled. consecutive burst accesses of a maximum four or eight words can be performed only during cpu instruction fetch. 1 or 2 states can be selected for burst rom access. 6.6.1 basic operation timing the number of access states in the initial cycle (full access) of the burst rom interface is determined by the ast bit in wscr. when the ast bit is set to 1, wait states can be inserted. 1 or 2 states can be selected for burst access acco rding to the setting of the brsts1 bit in bcr. wait states cannot be inserted in a burst cycl e. burst accesses of a maximum four words is performed when the brsts0 bit in bcr is cleared to 0, and burst accesses of a maximum eight words is performed when the brsts0 bit in bcr is set to 1. the basic access timing for the burst rom space is shown in figures 6.30 and 6.31. t 1 address bus as / ios data bus t 2 t 3 t 1 t 2 t 1 full access t 2 rd burst access only lower address changes read data read data read data (iose = 0) figure 6.30 access timing example in burst rom space (ast = brsts1 = 1)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 147 of 862 rej09b0429-0100 t 1 address bus data bus t 2 t 1 t 1 full access rd burst access only lower address changes read data read data read data as / ios (iose = 0) figure 6.31 access timing example in burst rom space (ast = brsts1 = 0) 6.6.2 wait control as with the basic bus interface, program wait insertion or pin wait insertion using the wait pin is possible in the initial cycle (full access) of the burst rom interface. for details, see section 6.5.6, wait control. wait states cannot be inserted in a burst cycle.
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 148 of 862 rej09b0429-0100 6.7 idle cycle when this lsi accesses the external address space, it can insert a 1-state idle cycle (t i ) between bus cycles when a write cy cle occurs immediately after a read cycl e. by inserting an idle cycle it is possible, for example, to avoid data collisions between rom with a long output floating time, and high-speed memory and i/o interfaces. if an external write occurs after an external read while the icis bit is set to 1 in bcr, an idle cycle is inserted at the star t of the write cycle. figure 6.32 shows examples of idle cycle operation. in these examples, bus cycle a is a read cycle for rom with a long output floating time, and bus cycle b is a cpu write cycle. in figure 6.32 (a), with no idle cycle inserted, a collision occurs in bus cycle b between the read data from rom and the cpu write data. in figure 6.32 (b), an idle cycle is inserted, thus preventing data collision. t 1 address bus bus cycle a data bus t 2 t 3 t 1 t 2 bus cycle b long output floating time data collision (a) no idle cycle insertion t 1 address bus bus cycle a data bus t 2 t 3 t i t 1 bus cycle b (b) idle cycle insertion t 2 wr wr rd rd figure 6.32 examples of idle cycle operation
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 149 of 862 rej09b0429-0100 table 6.15 shows the pin states in an idle cycle. table 6.15 pin states in idle cycle pins pin state a23 to a0 contents of immediately following bus cycle d15 to d0 high impedance as , ios , cs256 high rd high hwr , lwr high 6.8 bus arbitration 6.8.1 overview the bsc has a bus arbiter that arbitrates bus ma ster operations. there are two bus masters ? the cpu and dtc ? that perform read/write operations while they have bus mastership. 6.8.2 operation each bus master requests the bus mastership by means of a bus mastership request signal. the bus arbiter detects the bus mastership request signal from the bus masters, and if a bus request occurs, it sends a bus mastership request acknowledge signal to the bus master that made the request at the designated timing. if there are bus requests from more than one bus master, the bus mastership request acknowledge signal is sent to the one with the highest priority. when a bus master receives the bus mastership request acknowledge signal, it takes the bus mastership until that signal is canceled. the order of bus mast er priority is as follows: (high) dtc > cpu (low)
section 6 bus controller (bsc) rev. 1.00 mar. 17, 2008 page 150 of 862 rej09b0429-0100 6.8.3 bus mastership transfer timing when a bus request is received from a bus master with a higher priority than that of the bus master that has acquired the bus mastership and is currently operating, the bus mastership is not necessarily transferred immediately. each bus master can relinquish the bus mastership at the timings given below. (1) cpu the cpu is the lowest-priority bus master, and if a bus mastership request is received from the dtc, the bus arbiter transfers the bus mastership to the dtc. the timing for transferring the bus mastership is as follows: ? bus mastership is transferred at a break between bus cycles. however, if bus cycle is executed in discrete operations, as in the case of a long-word size access, the bus is not transferred at a break between the operations. for details see section 2.7, bus states during instruction execution in the h8s/2600 series, h8s/2000 series software manual. ? if the cpu is in sleep mode, it transf ers the bus mastership immediately. (2) dtc the dtc sends the bus arbiter a request for the bu s mastership when a request for dtc activation occurs. the dtc releases the bus mastership after a series of processes has completed.
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 151 of 862 rej09b0429-0100 section 7 data transfer controller (dtc) this lsi includes a data transfer controller (dtc ). the dtc can be activated by an interrupt or software, to transfer data. figure 7.1 shows a block diagram of the dtc. the dtc's register information is stored in the on- chip ram. when the dtc is used, the rame bit in syscr must be set to 1. a 32-bit bus connects the dtc to addresses h'ffec00 to h' ffefff in on-chip ram (1 kbyte), enabling 32- bit/1-state reading and writing of the dtc register information. 7.1 features ? transfer is possible over any number of channels ? three transfer modes ? normal, repeat, and block transfer modes are available ? one activation source can trigger a number of data transfers (chain transfer) ? direct specification of 16 mb ytes address space is possible ? activation by software is possible ? transfer can be set in byte or word units ? a cpu interrupt can be requested for the interrupt that activated the dtc ? module stop mode can be set ? dtc operates in high-speed mode even when the lsi is in medium-speed mode
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 152 of 862 rej09b0429-0100 internal address bus dtcer a to dtcer e dtvecr interrupt controller dtc on-chip ram internal data bus cpu interrupt request mra mrb cra crb dar sar interrupt request mra, mrb: cra, crb: sar: dar: dtcera to dtcere: dtvecr: dtc mode register a, b dtc transfer count register a, b dtc source address register dtc destination address register dtc enable registers a to e dtc vector register [legend] dtc activation request control logic register information figure 7.1 block diagram of dtc
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 153 of 862 rej09b0429-0100 7.2 register descriptions the dtc has the following registers. ? dtc mode register a (mra) ? dtc mode register b (mrb) ? dtc source address register (sar) ? dtc destination address register (dar) ? dtc transfer count register a (cra) ? dtc transfer count register b (crb) these six registers cannot be directly accessed fr om the cpu. when a dtc activation interrupt source occurs, the dtc reads a set of register info rmation that is stored in on-chip ram to the corresponding dtc registers and transfers data. after the data transfer, it writes a set of updated register information back to on-chip ram. ? dtc enable registers (dtcer) ? dtc vector register (dtvecr) ? keyboard comparator control register (kbcomp) ? event counter control register (eccr) ? event counter status register (ecs)
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 154 of 862 rej09b0429-0100 7.2.1 dtc mode register a (mra) mra selects the dtc operating mode. bit bit name initial value r/w description 7 6 sm1 sm0 undefined ? source address mode 1 and 0 these bits specify an sar operation after a data transfer. 0 * : sar is fixed 10: sar is incremented after a transfer (by +1 when sz = 0, by +2 when sz = 1) 11: sar is decremented after a transfer (by ?1 when sz = 0, by ?2 when sz = 1) 5 4 dm1 dm0 undefined ? destination address mode 1 and 0 these bits specify a dar operation after a data transfer. 0 * : dar is fixed 10: dar is incremented after a transfer (by +1 when sz = 0, by +2 when sz = 1) 11: dar is decremented after a transfer (by ?1 when sz = 0, by ?2 when sz = 1) 3 2 md1 md0 undefined ? dtc mode these bits specify the dtc transfer mode. 00: normal mode 01: repeat mode 10: block transfer mode 11: setting prohibited 1 dts undefined ? dtc transfer mode select specifies whether the source side or the destination side is set to be a repeat area or block area in repeat mode or block transfer mode. 0: destination side is repeat area or block area 1: source side is repeat area or block area 0 sz undefined ? dtc data transfer size specifies the size of data to be transferred. 0: byte-size transfer 1: word-size transfer note: * don't care
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 155 of 862 rej09b0429-0100 7.2.2 dtc mode register b (mrb) mrb selects the dtc operating mode. bit bit name initial value r/w description 7 chne undefined ? dtc chain transfer enable when this bit is set to 1, a chain transfer will be performed. for details, see section 7.6.4, chain transfer. in data transfer with chne set to 1, determination of the end of the specified number of data transfers, clearing of the interrupt source flag, and clearing of dtcer are not performed. 6 disel undefined ? dtc interrupt select when this bit is set to 1, a cpu interrupt request is generated every time data transfer ends. when this bit is cleared to 0, a cpu interrupt request is generated only when the specified number of data transfer ends. 5 to 0 ? undefined ? reserved these bits have no effect on dtc operation. the write value should always be 0. 7.2.3 dtc source address register (sar) sar is a 24-bit register that designates the source address of data to be transferred by the dtc. for word-size transfer, specify an even source address. 7.2.4 dtc destination address register (dar) dar is a 24-bit register that designates the destination address of data to be transferred by the dtc. for word-size transfer, specify an even destination address.
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 156 of 862 rej09b0429-0100 7.2.5 dtc transfer count register a (cra) cra is a 16-bit register that designates the number of times data is to be transferred by the dtc. in normal mode, the entire cra functions as a 16-bit transfer counter (1 to 65536). it is decremented by 1 every time data is transferred, and transfer ends when the count reaches h'0000. in repeat mode or block transfer mode, the cra is divided into two parts; the upper eight bits (crah) and the lower 8 bits (cral). crah holds the number of transfers while cral functions as an 8-bit transfer counter (1 to 256). cral is decremented by 1 every time data is transferred, and the contents of crah are sent when the count reaches h'00. 7.2.6 dtc transfer count register b (crb) crb is a 16-bit register that designates the number of times data is to be transferred by the dtc in block transfer mode. it functions as a 16-bit transfer counter (1 to 65536) that is decremented by 1 every time data is transferred, and transf er ends when the count reaches h'0000. 7.2.7 dtc enable registers (dtcer) dtcer specifies dtc activation interrupt sources. dtcer is comprised of five registers: dtcera to dtcere. the correspondence between interrupt sources and dtce bits is shown in tables 7.1 and 7.4. for dtce bit setting, use bit manipulation instructions such as bset and bclr. multiple dtc activation sources can be set at one time (only at the initial setting) by masking all interrupts and writing data after executing a dummy read on the relevant register. bit bit name initial value r/w description 7 to 0 dtce7 to dtce0 all 0 r/w dtc activation enable setting this bit to 1 specifies a relevant interrupt source as a dtc activation source. [clearing conditions] ? when data transfer has ended with the disel bit in mrb set to 1 ? when the specified number of transfers have ended these bits are not cleared when the disel bit is 0 and the specified number of transfers have not been completed
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 157 of 862 rej09b0429-0100 table 7.1 correspondence between interrupt sources and dtcer register bit bit name dtcera dtce rb dtcerc dtcerd dtcere 7 dtcen7 (16)irq0 ? ? (86)txi1 ? 6 dtcen6 (17)irq1 (76)iici2 ? ? ? 5 dtcen5 (18)irq2 (94)iici0 ? ? ? 4 dtcen4 (19)irq3 ? (29)eventi (78)iici3 ? 3 dtcen3 (28)adi ? ? (98)iici1 (104)err1 2 dtcen2 ? ? (81)rxi3 ? (105)ibfi1 1 dtcen1 ? ? (82)txi3 ? (106)ibfi2 0 dtcen0 ? ? (85)rxi1 ? (107)ibfi3 [legend] n: a to e ( ): vector number ? : reserved. the write value should always be 0. 7.2.8 dtc vector register (dtvecr) dtvecr enables or disables dtc activation by software, and sets a vector number for the software activation interrupt. bit bit name initial value r/w description 7 swdte 0 r/w dtc software activation enable setting this bit to 1 activates dtc. only 1 can be written to this bit. [clearing conditions] ? when the disel bit is 0 and the specified number of transfers have not ended ? when 0 is written to the disel bit after a software- activated data transfer end interrupt (swdtend) request has been sent to the cpu. this bit will not be cleared when the disel bit is 1 and data transfer has ended or when the specified number of transfers has ended.
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 158 of 862 rej09b0429-0100 bit bit name initial value r/w description 6 to 0 dtvec6 to dtvec0 all 0 r/w dtc software activation vectors 6 to 0 these bits specify a vector number for dtc software activation. the vector address is expressed as h'0400 + (vector number 2). for example, when dtvec6 to dtvec0 = h'10, the vector address is h'0420. when the swdte bit is 0, these bits can be written to. 7.2.9 keyboard comparator control register (kbcomp) kbcomp enables or disables the comparator scan function of event counter. bit bit name initial value r/w description 7 evente 0 r/w event count enable 0: disables event count function 1: enables event count function 6, 5 ? all 0 r reserved these bits are always read as 0 and cannot be modified. 4 to 0 ? all 0 r/w reserved the initial value should not be changed.
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 159 of 862 rej09b0429-0100 7.2.10 event counter control register (eccr) eccr selects the event counter channels for use and the detection edge. bit bit name initial value r/w description 7 edsb 0 r/w event counter edge select selects the detection edge for the event counter. 0: counts the rising edges 1: counts the falling edges 6 to 4 ? all 0 r reserved these bits are always read as 0 and cannot be modified. 3 to 0 ecsb3 to ecsb0 all 0 r/w event counter channel select 3 to 0 these bits select pins for event counter input. a series of pins are selected starting from event0. when panddr is set to 1, inputting events to event0 to event7 is ignored. 0000: event0 is used 0001: event0 to event1 are used 0010: event0 to event2 are used 0011: event0 to event3 are used 0100: event0 to event4 are used 0101: event0 to event5 are used 0110: event0 to event6 are used 0111: event0 to event7 are used 1000: event0 to event8 are used 1001: event0 to event9 are used 1010: event0 to event10 are used 1011: event0 to event11 are used 1100: event0 to event12 are used 1101: event0 to event13 are used 1110: event0 to event14 are used 1111: event0 to event15 are used
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 160 of 862 rej09b0429-0100 7.2.11 event counter status register (ecs) ecs is a 16-bit register that holds events temporarily. the dtc decides the counter to be incremented according to the state of this register. reading this register allows the monitoring of events that are not yet counted by the event counter. access in 8-bit unit is not allowed. bit bit name initial value r/w description 15 to 0 e15 to e0 0 r event monitor 15 to 0 these bits indicate processed/unprocessed states of the events that are input to event15 to event0. 0: the corresponding event is already processed 1: the corresponding event is not yet processed
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 161 of 862 rej09b0429-0100 7.3 dtc event counter to count events of event 0 to event15 by the dtc event counter function, set dtc as below. table 7.2 dtc event counter conditions register bit bit name description mra 7, 6 sm1, sm0 00: sar is fixed. 5, 4 dm1, dm0 00: dar is fixed. 3, 2 md1, md0 01: repeat mode 1 dts 0: destination is repeat area 0 sz 1: word size transfer mrb 7 chne 0: chain transfer is disabled 6 disel 0: interrupt request is generated when data is transferred by the number of specified times 5 to 0 ? b'000000 sar 23 to 0 ? dar 23 to 0 ? identical optional ram address. its lower five bits are b'00000. the start address of 16 words is this address. they are incremented every time an event is detected in event0 to event15. crah 7 to 0 ? h'ff cral 7 to 0 ? h'ff crbh 7 to 0 ? h'ff crbl 7 to 0 ? h'ff dtcerc 4 dtcec4 1: dtc function of the event counter is enabled kbcomp 7 evente 1: event counter enable ram ? ? (sar, dar) : result of event0 count (sar, dar) + 2: result of event 1 count (sar, dar) + 4: result of event 2 count (sar, dar) + 30: result of event 15 count the corresponding flag to ecs input pin is set to 1 when the event pins that are specified by the ecsb3 to ecsb0 in eccr detect the edge events specified by the edsb in eccr. for this flag state, status/address codes are generated. an eventi interrupt request is generated even if only one bit in ecs is set to 1.
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 162 of 862 rej09b0429-0100 the eventi interrupt request activates the dtc and transfers data from ram to ram in the same address. data is incremented in the dtc. the lower five bits of sar and dar are replaced with address code that is generated by the ecs flag status. when the dtc transfer is completed, th e ecs flag for transfer is cleared. table 7.3 flag status/address code ecs 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 address code 1 b'00000 1 0 b'00010 1 0 0 b'00100 1 0 0 0 b'00110 1 0 0 0 0 b'01000 1 0 0 0 0 0 b'01010 1 0 0 0 0 0 0 b'01100 1 0 0 0 0 0 0 0 b'01110 1 0 0 0 0 0 0 0 0 b'10000 1 0 0 0 0 0 0 0 0 0 b'10010 1 0 0 0 0 0 0 0 0 0 0 b'10100 1 0 0 0 0 0 0 0 0 0 0 0 b'10110 1 0 0 0 0 0 0 0 0 0 0 0 0 b'11000 1 0 0 0 0 0 0 0 0 0 0 0 0 0 b'11010 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 b'11100 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 b'11110 7.3.1 event counter handling priority event0 to event15 count handling is operated in the priority shown as below. high low event0 > event1 ? ? ? ? ? ? ? ? ? ? event14 > event15
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 163 of 862 rej09b0429-0100 7.3.2 usage notes there are following usage notes for this ev ent counter because it uses the dtc. 1. continuous events that are input from the same pin and out of dtc handling are ignored because the count up is operated by means of the dtc. 2. if some events are generated in short intervals, the priority of event counter handling is not ordered and events are not handled in order of arrival. 3. if the counter overflows, this event counter counts from h'0000 without generating an interrupt. 7.4 activation sources the dtc is activated by an interrupt request or by a write to dtvecr by software. the interrupt request source to activate the dtc is selected by dtce r. at the end of a data transfer (or the last consecutive transfer in the case of chain transfer), the interrupt flag that became the activation source or the corresponding dtcer bit is cleared. the activation source flag, in the case of rxi0, for example, is th e rdrf flag in sci_0. when an interrupt has been designated as a dtc activation source, the existing cpu mask level and interrupt controller priorities have no effect. if there is more than one activation source at the same time, the dtc operates in accordance with th e default priorities. figure 7.2 shows a block diagram of dtc activation source control. for details on the interrupt controller, see section 5, interrupt controller.
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 164 of 862 rej09b0429-0100 cpu dtc dtcer source flag cleared on-chip peripheral module irq interrupt interrupt request clear clear controller clear request interrupt controller selection circuit interrupt mask select dtvecr figure 7.2 block diagram of dtc activation source control
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 165 of 862 rej09b0429-0100 7.5 location of register info rmation and dtc vector table locate the register informatio n in the on-chip ram (addresses: h'ffec00 to h'ffefff). register information should be located at an address that is a multiple of four within the range. the method for locating the regist er information in address space is shown in figure 7.3. locate mra, sar, mrb, dar, cra, and crb, in that order, from the start address of the register information. in the case of chain transfer, register information should be located in consecutive areas as shown in figure 7.3, and the register information start address should be located at the vector address corresponding to the interrupt source in the dtc vector table. the dtc reads the start address of the register information from th e vector table set for each activation source, and then reads the register inform ation from that start address. when the dtc is activated by software, th e vector address is obtained from: h'0400 + (dtvecr[6:0] 2). for example, if dtvecr is h'10, the vector address is h'0420. the configuration of the vector address is a 2-byte unit. specify the lower two bytes of the register information start address. mra 0123 sar mrb dar cra crb mra sar mrb dar cra crb lower address 4 bytes register information register information for 2nd transfer in chain transfer register information start address chain transfer figure 7.3 dtc register inform ation location in address space
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 166 of 862 rej09b0429-0100 table 7.4 interrupt sources, dtc vect or addresses, and corresponding dtces activation source origin activation source vector number dtc vector address dtce * priority software write to dtvecr dtvecr h'0400 + (vector number x 2) ? high external pins irq0 16 h'0420 dtcea7 irq1 17 h'0422 dtcea6 irq2 18 h'0424 dtcea5 irq3 19 h'0426 dtcea4 a/d converter adi 28 h'0438 dtcea3 evc eventi 29 h'043a dtcec4 iic_2 iici2 76 h'0498 dtceb6 iic_3 iici3 78 h'049c dtced4 sci_3 rxi3 81 h'04a2 dtcec2 txi3 82 h'04a4 dtcec1 sci_1 rxi1 85 h'04aa dtcec0 txi1 86 h'04ac dtced7 iic_0 iici0 94 h'04bc dtceb5 iic_1 iici1 98 h'04c4 dtced3 lpc erri 104 h'04d0 dtcee3 ibfi1 105 h'04d2 dtcee2 ibfi2 106 h'04d4 dtcee1 ibfi3 107 h'04d6 dtcee0 low note: * dtce bits with no corresponding interrupt are reserved, and the write value should always be 0.
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 167 of 862 rej09b0429-0100 7.6 operation the dtc stores register information in on-chi p ram. when activated, the dtc reads register information in on-chip ram and transfers data. after the data transfer, the dtc writes updated register information back to on-chip ram. the pre-storage of register information in memory makes it possible to transfer data over any required number of channels. the transfer mode can be specified as normal, repeat, or block transfer mode. setting the chne bit in mrb to 1 makes it possible to perform a number of transfers with a single activation source (chain transfer). the 24-bit sar designates the dtc transfer source address, and the 24-bit dar designates the transfer destination address. after each transfer, sar and dar are independently incremented, decremented, or left fixed depending on its register information. start end read dtc vector read register information data transfer write register information clear an activation flag interrupt exception handling clear dtcer chne = 1 next transfer yes yes no transfer counter = 0 or disel = 1 no figure 7.4 dtc operation flowchart
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 168 of 862 rej09b0429-0100 7.6.1 normal mode in normal mode, one activation source transfers one byte or one word of data. table 7.5 lists the register functions in normal mode. from 1 to 65,536 transfers can be specified. once the specified number of transfers has been completed, a cpu interrupt can be requested. table 7.5 register functions in normal mode name abbreviation function dtc source address register sar transfer source address dtc destination address register dar transfer destination address dtc transfer count register a cra transfer counter dtc transfer count register b crb not used transfer sar dar figure 7.5 memory mapping in normal mode
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 169 of 862 rej09b0429-0100 7.6.2 repeat mode in repeat mode, one activation source transfers one byte or one word of data. table 7.6 lists the register functions in repeat mode. from 1 to 256 transfers can be specified. once the specified number of transfers has been completed, the initial states of the transfer counter and the address register that is specified as the repeat area is restored, and transfer is repeated. in repeat mode, the transfer counter value does not reach h'00, and th erefore cpu interrupts cannot be requested when the disel bit in mrb is cleared to 0. table 7.6 register functions in repeat mode name abbreviation function dtc source address register sar transfer source address dtc destination address register dar transfer destination address dtc transfer count register ah crah holds number of transfers dtc transfer count register al cral transfer count dtc transfer count register b crb not used transfer sar or dar dar or sar repeat area figure 7.6 memory mapping in repeat mode
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 170 of 862 rej09b0429-0100 7.6.3 block transfer mode in block transfer mode, one activation source transfers one block of data. either the transfer source or the transfer destination is designated as a block area. table 7.7 lists the register functions in block transfer mode. the block size can be between 1 and 256. when the transfer of one block ends, the initial state of the block size counter and th e address register that is specified as the block area is restored. the other address register is then incremented, decrem ented, or left fixed according to the register information. from 1 to 65,536 tr ansfers can be specified. once the specified number of transfers has been completed, a cpu interrupt is requested. table 7.7 register functions in block transfer mode name abbreviation function dtc source address register sar transfer source address dtc destination address register dar transfer destination address dtc transfer count register ah crah holds block size dtc transfer count register al cral block size counter dtc transfer count register b crb transfer counter transfer sar or dar dar or sar block area    1st block n th block figure 7.7 memory mapping in block transfer mode
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 171 of 862 rej09b0429-0100 7.6.4 chain transfer setting the chne bit in mrb to 1 enables a number of data transfers to be performed consecutively in response to a single transfer request. sar, dar, cra, crb, mra, and mrb, which define data transfers, can be set independently. figure 7.8 shows the overview of chain transfer operation. when activat ed, the dtc reads the register information start address stored at the dtc vector address, and then reads the first register information at that start address. after the data transfer, the chne bit will be tested. when it has been set to 1, dtc reads the next register in formation located in a consecutive area and performs the data transfer. these sequences are rep eated until the chne bit is cleared to 0. in the case of transfer with the chne bit set to 1, an interrupt request to the cpu is not generated at the end of the specified number of transfers or by setting of the disel bit to 1, and the interrupt source flag for the activation source is not affected. dtc vector address source destination source destination register information chne = 1 register information chne = 0 register information start address figure 7.8 chain transfer operation
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 172 of 862 rej09b0429-0100 7.6.5 interrupt sources an interrupt request is issued to the cpu when the dtc has completed the specified number of data transfers, or a data transfer for which the disel bit was set to 1. in the case of interrupt activation, the interrupt set as the activation sour ce is generated. these interrupts to the cpu are subject to cpu mask level and priority level control by the interrupt controller. in the case of software activation, a software-ac tivated data transfer end interrupt (swdtend) is generated. when the disel bit is 1 and one data transfer has been completed, or the specified number of transfers have been completed, after data transfer ends, the swdte bit is held at 1 and an swdtend interrupt is generated. the interrupt handling routine will then clear the swdte bit to 0. when the dtc is activated by software, an swdtend interrupt is not generated during a data transfer wait or during data transfer even if the swdte bit is set to 1. 7.6.6 operation timing dtc activation request dtc request address vector read read write transfer information read transfer information write data transfer figure 7.9 dtc operation timing (example in normal mode or repeat mode)
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 173 of 862 rej09b0429-0100 dtc activation request dtc request address vector read read write read write transfer information read transfer information write data transfer figure 7.10 dtc operation timing (example of block transfer mode, with block size of 2) dtc activation request dtc request address vector read read write read write transfer information read transfer information write transfer information read transfer information write data transfer data transfer figure 7.11 dtc operation timing (example of chain transfer) 7.6.7 number of dtc execution states table 7.8 lists the execution status for a single dtc data transfer, and table 7.9 shows the number of states required for each execution status.
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 174 of 862 rej09b0429-0100 table 7.8 dtc execution status mode vector read i register information read/write j data read k data write l internal operations m normal 1 6 1 1 3 repeat 1 6 1 1 3 block transfer 1 6 n n 3 [legend] n: block size (initial setting of crah and cral) table 7.9 number of states requi red for each execution status object to be accessed on-chip ram (h'ffec00 to h'ffefff) on-chip ram (on-chip ram area other than h'ffec00 to h'ffefff) on- chip rom on-chip i/o registers external devices bus width 32 16 16 8 16 8 8 16 16 access states 1 1 1 2 2 2 3 2 3 vector read s i ? ? 1 ? ? 4 6 + 2m 2 3 + m execution status register information read/write s j 1 ? ? ? ? ? ? ? ? byte data read s k 1 1 1 2 2 2 3 + m 2 3 + m word data read s k 1 1 1 4 2 4 6 + 2m 2 3 + m byte data write s l 1 1 1 2 2 2 3 + m 2 3 + m word data write s l 1 1 1 4 2 4 6 + 2m 2 3 + m internal operation s m 1 1 1 1 1 1 1 1 1 the number of execution states is calculated from using the formula below. note that is the sum of all transfers activated by one activation source (the number in which the chne bit is set to 1, plus 1). number of execution states = i s i + (j s j + k s k + l s l ) + m s m
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 175 of 862 rej09b0429-0100 for example, when the dtc vector address table is located in on-chip rom, normal mode is set, and data is transferred from on-chip rom to an internal i/o register, then the time required for the dtc operation is 13 states. the time from activa tion to the end of data write is 10 states. 7.7 procedures for using dtc 7.7.1 activation by interrupt the procedure for using the dtc with interrupt activation is as follows: 1. set the mra, mrb, sar, dar, cra, and crb register information in on-chip ram. 2. set the start address of the register information in the dtc vector address. 3. set the corresponding bit in dtcer to 1. 4. set the enable bits for the interrupt sources to be used as the activation sources to 1. the dtc is activated when an interrupt used as an activation source is generated. 5. after one data transfer has been completed, or after the specified number of data transfers have been completed, the dtce bit is cleared to 0 and a cpu interrupt is requested. if the dtc is to continue transferring data, set the dtce bit to 1. 7.7.2 activation by software the procedure for using the dtc with software activation is as follows: 1. set the mra, mrb, sar, dar, cra, and crb register information in on-chip ram. 2. set the start address of the register information in the dtc vector address. 3. check that the swdte bit is 0. 4. write 1 to the swdte bit and the vector number to dtvecr. 5. check the vector number written to dtvecr. 6. after one data transfer has been completed, if the disel bit is 0 and a cpu interrupt is not requested, the swdte bit is cleared to 0. if the dtc is to continue transferring data, set the swdte bit to 1. when the disel bit is 1 or after the specified number of data transfers have been completed, the swdte bit is held at 1 and a cpu interrupt is requested.
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 176 of 862 rej09b0429-0100 7.8 examples of use of the dtc 7.8.1 normal mode an example is shown in which the dtc is used to receive 128 bytes of data via the sci. 1. set mra to a fixed source address (sm1 = sm0 = 0), incrementing destination address (dm1 = 1, dm0 = 0), normal mode (md1 = md0 = 0), and byte size (sz = 0). the dts bit can have any value. set mrb for one data transfer by one interrupt (chne = 0, disel = 0). set the sci, rdr address in sar, the start address of the ram area where the data will be received in dar, and 128 (h 0080) in cra. crb can be set to any value. 2. set the start address of the register information at the dtc vector address. 3. set the corresponding bit in dtcer to 1. 4. set the sci to the appropriate receive mode . set the rie bit in s cr to 1 to enable the reception complete (rxi) interr upt. since the generation of a receive error during the sci reception operation will disable subsequent reception, the cp u should be enabled to accept receive error interrupts. 5. each time the reception of one byte of data ha s been completed on the sci, the rdrf flag in ssr is set to 1, an rxi interrupt is generated, and the dtc is activated. the receive data is transferred from rdr to ram by the dtc. dar is incremented and cra is decremented. the rdrf flag is automa tically cleared to 0. 6. when cra becomes 0 after 128 data transfers ha ve been completed, the rdrf flag is held at 1, the dtce bit is cleared to 0, and an rxi interrupt request is sent to the cpu. the interrupt handling routine will perform wrap-up processing.
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 177 of 862 rej09b0429-0100 7.8.2 software activation an example is shown in which the dtc is used to transfer a block of 128 bytes of data by means of software activation. the transfer source address is h'1000 and the transfer destination address is h'2000. the vector number is h 60, so the vector address is h'04c0. 1. set mra to incrementing source address (sm1 = 1, sm0 = 0), incrementing destination address (dm1 = 1, dm0 = 0), block transfer mode (md1 = 1, md0 = 0), and byte size (sz = 0). the dts bit can have any value. set mrb for one block transfer by one interrupt (chne = 0). set the transfer source address (h'1000) in sar, the transfer destination address (h'2000) in dar, and 128 (h'8080) in cra. set 1 (h'0001) in crb. 2. set the start address of the register information at the dtc vector address (h'04c0). 3. check that the swdte bit in dt vecr is 0. check that there is currently no tran sfer activated by software. 4. write 1 to the swdte bit and the vector number (h'60) to dtvecr. the write data is h'e0. 5. read dtvecr again and check that it is set to the vector number (h'60). if it is not, this indicates that the write failed. this is presum ably because an interrupt occurred between steps 3 and 4 and led to a different software activation. to activate this transfer , go back to step 3. 6. if the write was successful, the dtc is activated and a block of 128 bytes of data is transferred. 7. after the transfer, an swdtend interrupt occurs. the interrupt handling routine should clear the swdte bit to 0 and perform wrap-up processing.
section 7 data transfer controller (dtc) rev. 1.00 mar. 17, 2008 page 178 of 862 rej09b0429-0100 7.9 usage notes 7.9.1 module stop mode setting dtc operation can be enabled or disabled by the module stop control register (mstpcr). in the initial state, dtc operation is enabled. access to dtc registers is disabled when module stop mode is set. note that when the dtc is being activated, module stop mode cannot be specified. for details, refer to section 24, power-down modes. 7.9.2 on-chip ram mra, mrb, sar, dar, cra, and crb are all located in on-chip ram. when the dtc is used, the rame bit in syscr should not be cleared to 0. 7.9.3 dtce bit setting for dtce bit setting, use bit manipulation instructions such as bset and bclr, for reading and writing. multiple dtc activation sources can be set at one time (only at the initial setting) by masking all interrupts and writing data after executing a dummy read on the relevant register. 7.9.4 dtc activation by interrupt so urces of sci, iic, or a/d converter interrupt sources of the sci, iic, or a/d converter which activate the dtc are cleared when dtc reads from or writes to the respec tive registers, and they cannot be cleared by the disel bit.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 179 of 862 rej09b0429-0100 section 8 i/o ports table 8.1 is a summary of the port functions. the pins of each port also function as input/output pins of peripheral modules and interrupt input pins. each input/output port includes a data direction register (ddr) that controls input/output and a data register (dr) that stores output data. ddr and dr are not provided for input-only ports. pins of ports 1 to 4, 6, and a and pins d0 to d5 of port d have built-in input pull-up moss. for port a pins and d0 to d5 pins, the on/off status of the input pull-up mos is controlled by their respective ddr and the output data register (odr). ports 1 to 3, and 6 have an input pull-up mos control register (pcr), in addition to ddr and dr, to control the on/off status of the input pull-up moss. port 6 has built-in de-bouncers (dbn) that eliminate noises in the input signals. ports 4 and f are designed for retain state outputs (rsn), which retain the output values on the pins even if a reset is generated when the watchdog timer has overflowed. ports 1 to 6, and 8 to e can drive a single ttl load and 30 pf capacitive load. all the i/o ports can drive a darlington transistor in output mode. port pins 80 to 83, c0 to c5, d6, and d7 are nmos push-pull output.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 180 of 862 rej09b0429-0100 table 8.1 port functions port description extended mode (expe = 1) single-chip mode (expe = 0) feature of i/o port 1 general i/o port multiplexed with address output and address-data multiplex i/o p17/a7/ad7 p16/a6/ad6 p15/a5/ad5 p14/a4/ad4 p13/a3/ad3 p12/a2/ad2 p11/a1/ad1 p10/a0/ad0 p17 p16 p15 p14 p13 p12 p11 p10 built-in input pull-up mos port 2 general i/o port multiplexed with address output and address-data multiplex i/o p27/a15/ad15 p26/a14/ad14 p25/a13/ad13 p24/a12/ad12 p23/a11/ad11 p22/a10/ad10 p21/a9/ad9 p20/a8/ad8 p27 p26 p25 p24 p23 p22 p21 p20 built-in input pull-up mos port 3 general i/o port multiplexed with bidirectional data bus i/o p37/d15 p36/d14 p35/d13 p34/d12 p33/d11 p32/d10 p31/d9 p30/d8 p37 p36 p35 p34 p33 p32 p31 p30 built-in input pull-up mos port 4 general i/o port multiplexed with interrupt input p47/ irq7 /rs7/hc7 p46/ irq6 /rs6/hc6 p45/ irq5 /rs5/hc5 p44/ irq4 /rs4/hc4 p43/ irq3 /rs3/hc3 p42/ irq2 /rs2/hc2 p41/ irq1 /rs1/hc1 p40/ irq0 /rs0/hc0 same as left led driving capability (sink current 12 ma)
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 181 of 862 rej09b0429-0100 port description extended mode (expe = 1) single-chip mode (expe = 0) feature of i/o port 5 general i/o port multiplexed with interrupt input, pwmx output, sci_1, sci_3, and scif i/o p57/ irq15 /pwx1 p56/ irq14 /pwx0 p55/ irq13 /rxd3 p54/ irq12 /txd3 p53/ irq11 /rxd1 p52/ irq10 /txd1 p51/ irq9 /rxdf p50/ irq8 /txdf same as left port 6 general i/o port multiplexed with scif control i/o and bidirectional data bus i/o p67/db7 p66/db6 p65/db5/ rts p64/db4/ cts p63/db3 p62/db2 p61/db1 p60/db0 d7 * d6 * d5 * d4 * d3 * d2 * d1 * d0 * p67/db7 p66/db6 p65/db5/ rts p64/db4/ cts p63/db3 p62/db2 p61/db1 p60/db0 built-in input pull-up mos port 7 general input port multiplexed with a/d converter analog input and interrupt input p77/ exirq7 /an7 p76/ exirq6 /an6 p75/ exirq5 /an5 p74/ exirq4 /an4 p73/ exirq3 /an3 p72/ exirq2 /an2 p71/ exirq1 /an1 p70/ exirq0 /an0 same as left p87/ exirq15 / adtrg p86/ exirq14 p85/ exirq13 /sck1 p84/ exirq12 /sck3 same as left port 8 general i/o port multiplexed with a/d converter external trigger input, interrupt input, sci_1 and sci_3 clock i/o, and iic_0 and iic_1 i/o p83/ exirq11 /sda1 p82/ exirq10 /scl1 p81/ exirq9 /sda0 p80/ exirq8 /scl0 same as left nmos push-pull output
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 182 of 862 rej09b0429-0100 port description extended mode (expe = 1) single-chip mode (expe = 0) feature of i/o port 9 general i/o port multiplexed with bus control i/o, system clock output, and external subclock input p97/ wait / cs256 p96/ /excl as / ios hwr / wr rd p92/ hbe p91/ ah p90/ lwr / lbe p97 p96/ /excl p95 p94 p93 p92 p91 p90 port a general i/o port multiplexed with dtc event counter input and address output pa7/event7/a23 pa6/event6/a22 pa5/event5/a21 pa4/event4/a20 pa3/event3/a19 pa2/event2/a18 pa1/event1/a17 pa0/event0/a16 pa7/event7 pa6/event6 pa5/event5 pa4/event4 pa3/event3 pa2/event2 pa1/event1 pa0/event0 built-in input pull-up mos port b general i/o port multiplexed with dtc event counter input pb7/event15 pb6/event14 pb5/event13 pb4/event12 pb3/event11 pb2/event10 pb1/event9 pb0/event8 same as left pc7/pwx3 pc6/pwx2 same as left port c general i/o port multiplexed with pwmx output and iic_2, iic_3, and iic_4 i/o pc5/sda4 pc4/scl4 pc3/sda3 pc2/scl3 pc1/sda2 pc0/scl2 same as left nmos push-pull output
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 183 of 862 rej09b0429-0100 port description extended mode (expe = 1) single-chip mode (expe = 0) feature of i/o pd7/sda5 pd6/scl5 same as left nmos push-pull output port d general i/o port multiplexed with lpc i/o and iic_5 i/o pd5/ lpcpd pd4/ clkrun pd3/ga20 pd2/ pme pd1/ lsmi pd0/lsci same as left built-in input pull-up mos port e general i/o port multiplexed with lpc i/o pe7/serirq pe6/lclk pe5/ lreset pe4/ lframe pe3/lad3 pe2/lad2 pe1/lad1 pe0/lad0 same as left port f general i/o port pf3/rs11 pf2/rs10 pf1/rs9 pf0/rs8 same as left note: * available when configured for 16-bit data bus.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 184 of 862 rej09b0429-0100 8.1 port 1 port 1 is an 8-bit i/o port. port 1 pins can also function as the address bus and address-data multiplex bus pins. the pin functions change according to the operating mode. port 1 has the following registers. ? port 1 data direction register (p1ddr) ? port 1 data register (p1dr) ? port 1 pull-up mos control register (p1pcr) 8.1.1 port 1 data di rection register (p1ddr) the individual bits of p1ddr specify input or output for the pins of port 1. bit bit name initial value r/w description 7 p17ddr 0 w 6 p16ddr 0 w 5 p15ddr 0 w 4 p14ddr 0 w 3 p13ddr 0 w 2 p12ddr 0 w 1 p11ddr 0 w 0 p10ddr 0 w ? normal extended mode (admxe = 0) when set to 1, the corresponding pins function as address output pins; when cleared to 0, function as input port pins. ? address-data multiplex extended mode (admxe = 1) these bits correspond to the ad7 to ad0 pins of the address-data multiplex bus. ? single-chip mode when set to 1, the corresponding pins function as output port pins; when cleared to 0, function as input port pins.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 185 of 862 rej09b0429-0100 8.1.2 port 1 data register (p1dr) p1dr stores output data for the port 1 pins. bit bit name initial value r/w description 7 p17dr 0 r/w 6 p16dr 0 r/w 5 p15dr 0 r/w 4 p14dr 0 r/w 3 p13dr 0 r/w 2 p12dr 0 r/w 1 p11dr 0 r/w 0 p10dr 0 r/w p1dr stores output data for the port 1 pins that are used as the general output port. if this register is read, the p1dr values are read for the bits with the corresponding p1ddr bits set to 1. for the bits with the corresponding p1ddr bits cleared to 0, the pin states are read. 8.1.3 port 1 pull-up mos control register (p1pcr) p1pcr controls the port 1 built-in input pull-up moss. bit bit name initial value r/w description 7 p17pcr 0 r/w 6 p16pcr 0 r/w 5 p15pcr 0 r/w 4 p14pcr 0 r/w 3 p13pcr 0 r/w 2 p12pcr 0 r/w 1 p11pcr 0 r/w 0 p10pcr 0 r/w when the pins are in the input state, the corresponding input pull-up mos is turned on when a p1pcr bit is set to 1. do not change the initial value when using the address-data multiplex extended bus mode.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 186 of 862 rej09b0429-0100 8.1.4 pin functions the relationship between the register settings and the pin function is shown below. (1) extended mode (expe = 1) the pin function is switched as shown below according to the p1nddr bit. p1nddr 0 1 admxe 0 1 0 1 abw, abw256 x either bit is 0 (8/16-bit bus) both bits are 1 (8-bit bus) x either bit is 0 (8/16-bit bus) both bits are 1 (8-bit bus) pin function p1n input pin adn input/output pin p1n input pin an output pin setting prohibited p1n output pin [legend] n = 7 to 0, x: don't care. (2) single-chip mode (expe = 0) the pin function is switched as shown below according to the p1nddr bit. p1nddr 0 1 pin function p1n input pin p1n output pin [legend] n = 7 to 0 8.1.5 port 1 input pull-up mos port 1 has built-in input pull-up moss that can be controlled by software. the input pull-up mos can be used regardless of the operating mode. table 8.2 summarizes the input pull-up mos states. table 8.2 port 1 input pull-up mos states reset hardware standby mode software standby mode in other operations off off on/off on/off [legend] off: always off. on/off: on when p1ddr = 0 and p1pcr = 1; otherwise off.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 187 of 862 rej09b0429-0100 8.2 port 2 port 2 is an 8-bit i/o port. port 2 pins can also function as the address bus and address-data multiplex bus pins. the pin functions change according to the operating mode. port 2 has the following registers. ? port 2 data direction register (p2ddr) ? port 2 data register (p2dr) ? port 2 pull-up mos control register (p2pcr) 8.2.1 port 2 data di rection register (p2ddr) the individual bits of p2ddr specify input or output for the pins of port 2. bit bit name initial value r/w description 7 p27ddr 0 w 6 p26ddr 0 w 5 p25ddr 0 w 4 p24ddr 0 w 3 p23ddr 0 w 2 p22ddr 0 w 1 p21ddr 0 w 0 p20ddr 0 w ? normal extended mode (admxe = 0) when set to 1, the corresponding pins function as address output pins; when cleared to 0, function as input port pins. the address output pins used are in accord with the settings of the iose and cs256e bits of syscr. ? address-data multiplex extended mode (admxe = 1) these bits correspond to the ad15 to ad8 pins of the address-data multiplex bus. ? single-chip mode when set to 1, the corresponding pins function as output port pins; when cleared to 0, function as input port pins.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 188 of 862 rej09b0429-0100 8.2.2 port 2 data register (p2dr) p2dr stores output data for the port 2 pins. bit bit name initial value r/w description 7 p27dr 0 r/w 6 p26dr 0 r/w 5 p25dr 0 r/w 4 p24dr 0 r/w 3 p23dr 0 r/w 2 p22dr 0 r/w 1 p21dr 0 r/w 0 p20dr 0 r/w p2dr stores output data for the port 2 pins that are used as the general output port. if this register is read, the p2dr values are read for the bits with the corresponding p2ddr bits set to 1. for the bits with the corresponding p2ddr bits cleared to 0, the pin states are read. 8.2.3 port 2 pull-up mos control register (p2pcr) p2pcr controls the port 2 built-in input pull-up moss. bit bit name initial value r/w description 7 p27pcr 0 r/w 6 p26pcr 0 r/w 5 p25pcr 0 r/w 4 p24pcr 0 r/w 3 p23pcr 0 r/w 2 p22pcr 0 r/w 1 p21pcr 0 r/w 0 p20pcr 0 r/w when the pins are in the input state, the corresponding input pull-up mos is turned on when a p2pcr bit is set to 1. do not change the initial value when using the address-data multiplex extended mos mode.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 189 of 862 rej09b0429-0100 8.2.4 pin functions the relationship between the register settings and the pin function is shown below. (1) extended mode (expe = 1) the pin function is switched as shown below acco rding to the combination of the cs256e and iose bits in syscr, the adfulle bit in bcr2 of the bsc, and the p2nddr bit. address 11 in the table below is expressed by the following logical expression. address 11 = 1: adfulle ? cs256e ? iose p2nddr 0 1 admxe 0 1 0 1 address 11 x x 0 1 x pin function p2n input pin adm input/output pin am output pin p2n output pin adm input/output pin [legend] m = 15 to 11, n = 7 to 3, x: don't care. p2nddr 0 1 admxe 0 1 0 1 pin function p2n input pin adm input/output pin am output pin adm input/output pin [legend] m = 10 to 8, n = 2 to 0 (2) single-chip mode (expe = 0) the pin function is switched as shown below according to the p2nddr bit. p2nddr 0 1 pin function p2n input pin p2n output pin [legend] n = 7 to 0
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 190 of 862 rej09b0429-0100 8.2.5 port 2 input pull-up mos port 2 has built-in input pull-up moss that can be controlled by software. the input pull-up mos can be used regardless of the operating mode. table 8.3 summarizes the input pull-up mos states. table 8.3 port 2 input pull-up mos states reset hardware standby mode software standby mode in other operations off off on/off on/off [legend] off: always off. on/off: on when p2ddr = 0 and p2pcr = 1; otherwise off.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 191 of 862 rej09b0429-0100 8.3 port 3 port 3 is an 8-bit i/o port. port 3 pins can also function as the bidirectional data bus and de- bounced input pins. the pin functions change acco rding to the operating mode. port 3 has the following registers. ? port 3 data direction register (p3ddr) ? port 3 data register (p3dr) ? port 3 pull-up mos control register (p3pcr) 8.3.1 port 3 data di rection register (p3ddr) the individual bits of p3ddr specify input or output for the port 3 pins. bit bit name initial value r/w description 7 p37ddr 0 w 6 p36ddr 0 w 5 p35ddr 0 w 4 p34ddr 0 w 3 p33ddr 0 w 2 p32ddr 0 w 1 p31ddr 0 w 0 p30ddr 0 w ? normal extended mode (admxe = 0) the pins function as bidirectional data bus pins. ? other modes when set to 1, the corresponding pins function as output port pins; when cleared to 0, function as input port pins.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 192 of 862 rej09b0429-0100 8.3.2 port 3 data register (p3dr) p3dr stores output data for the port 3 pins. bit bit name initial value r/w description 7 p37dr 0 r/w 6 p36dr 0 r/w 5 p35dr 0 r/w 4 p34dr 0 r/w 3 p33dr 0 r/w 2 p32dr 0 r/w 1 p31dr 0 r/w 0 p30dr 0 r/w ? normal extended mode (admxe = 0) since the port 3 pins function as bidirectional data bus pins, the value of this register has no effect on operation. if this register is read, the p3dr values are read for the bits with the corresponding p3ddr bits set to 1. for the bits with the corresponding p3ddr bits cleared to 0, 1 is read. ? other modes p3dr stores output data for the port 3 pins that are used as the general output port. if this register is read, the p3dr values are read for the bits with the corresponding p3ddr bits set to 1. for the bits with the corresponding p3ddr bits cleared to 0, the pin states are read. 8.3.3 port 3 pull-up mos control register (p3pcr) p3pcr controls the port 3 built-in input pull-up moss. bit bit name initial value r/w description 7 p37pcr 0 r/w 6 p36pcr 0 r/w 5 p35pcr 0 r/w 4 p34pcr 0 r/w 3 p33pcr 0 r/w 2 p32pcr 0 r/w 1 p31pcr 0 r/w 0 p30pcr 0 r/w ? normal extended mode (admxe = 0) this register has no effect on operation. ? other modes when the pins are in the input state, the corresponding input pull-up mos is turned on when a p3pcr bit is set to 1.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 193 of 862 rej09b0429-0100 8.3.4 pin functions (1) normal extended mode port 3 pins are automatically set to function as bidirectional data bus pins. (2) address-data multiplex extended mode the operation is the same as that in single-chip mode. (3) single-chip mode the pin function is switched as shown below according to the p3nddr bit. p3nddr 0 1 pin function p3n input pin p3n output pin [legend] n = 7 to 0 8.3.5 port 3 input pull-up mos port 3 has built-in input pull-up moss that can be controlled by software. the input pull-up mos can be used in single-chip mode and address-data multiplex extended mode. table 8.4 summarizes the input pull-up mos states. table 8.4 port 3 input pull-up mos states mode reset hardware standby mode software standby mode in other operations normal extended mode (expe = 1, admxe = 0) off off off off single-chip mode (expe = 0) address-data multiplex extended mode (expe = 1, admxe = 1) off off on/off on/off [legend] off: always off. on/off: on when input state and p3pcr = 1; otherwise off.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 194 of 862 rej09b0429-0100 8.4 port 4 port 4 is an 8-bit i/o port. port 4 pins can also function as the external interrupt input pins. port 4 has the following registers. ? port 4 data direction register (p4ddr) ? port 4 data register (p4dr) ? port 4 pull-up mos control register (p4pcr) 8.4.1 port 4 data di rection register (p4ddr) the individual bits of p4ddr specify input or output for the port 4 pins. p4ddr is initialized only by a system reset, and retains the value even if an internal reset signal of the wdt is generated. bit bit name initial value r/w description 7 p47ddr 0 w 6 p46ddr 0 w 5 p45ddr 0 w 4 p44ddr 0 w 3 p43ddr 0 w 2 p42ddr 0 w 1 p41ddr 0 w 0 p40ddr 0 w the corresponding pins function as output port when the p4ddr bits are set to 1, and as input port when cleared to 0.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 195 of 862 rej09b0429-0100 8.4.2 port 4 data register (p4dr) p4dr stores output data for the port 4 pins. p4dr is initialized only by a system reset, and retains the value even if an internal reset signal of the wdt is generated. bit bit name initial value r/w description 7 p47dr 0 r/w 6 p46dr 0 r/w 5 p45dr 0 r/w 4 p44dr 0 r/w 3 p43dr 0 r/w 2 p42dr 0 r/w 1 p41dr 0 r/w 0 p40dr 0 r/w these bits store output data for the port 4 pins that are used as the general output port. if this register is read, the p4dr values are read for the bits with the corresponding p4ddr bits set to 1. for the bits with the corresponding p4ddr bits cleared to 0, the pin states are read. 8.4.3 port 4 pull-up mos control register (p4pcr) p4pcr controls the port 4 built-in input pull-up moss. bit bit name initial value r/w description 7 p47pcr 0 r/w 6 p46pcr 0 r/w 5 p45pcr 0 r/w 4 p44pcr 0 r/w 3 p43pcr 0 r/w 2 p42pcr 0 r/w 1 p41pcr 0 r/w 0 p40pcr 0 r/w when the pins are in the input state, the corresponding input pull-up mos is turned on when a p4pcr bit is set to 1.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 196 of 862 rej09b0429-0100 8.4.4 pin functions the relationship between register setting values and pin functions are as follows. the pin function is switched as shown below accordi ng to the p4nddr bit. when the i ssn bit in issr is cleared to 0 and the irqne bit in ier of the interrupt controller is set to 1, the pin can be used as the irqn input pin. to use as the irqn input pin, clear the p4nddr bit to 0. p4nddr 0 1 p4n input pin pin function irqn input pin p4n output pin [legend] n = 7 to 0
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 197 of 862 rej09b0429-0100 8.5 port 5 port 5 is an 8-bit i/o port. port 5 pins can also function as the scif and sci_1 input/output, bus control output, system clock output, external subclock input, and interrupt input pins. port 5 has the following registers. ? port 5 data direction register (p5ddr) ? port 5 data register (p5dr) 8.5.1 port 5 data di rection register (p5ddr) the individual bits of p5ddr specify input or output for the port 5 pins. bit bit name initial value r/w description 7 p57ddr 0 w 6 p56ddr 0 w 5 p55ddr 0 w 4 p54ddr 0 w 3 p53ddr 0 w 2 p52ddr 0 w 1 p51ddr 0 w 0 p50ddr 0 w if port 5 pins are specified for use as the general i/o port, the corresponding pins function as output port when the p5ddr bits are set to 1, and as input port when cleared to 0.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 198 of 862 rej09b0429-0100 8.5.2 port 5 data register (p5dr) p5dr stores output data for the port 5 pins. bit bit name initial value r/w description 7 p57dr 0 r/w 6 p56dr 0 r/w 5 p55dr 0 r/w 4 p54dr 0 r/w 3 p53dr 0 r/w 2 p52dr 0 r/w 1 p51dr 0 r/w 0 p50dr 0 r/w p5dr stores output data for the port 5 pins that are used as the general output port. if this register is read, the p5dr values are read for the bits with the corresponding p5ddr bits set to 1. for the bits with the corresponding p5ddr bits cleared to 0, the pin states are read. 8.5.3 pin functions port 5 pins can operate as the pwmx output, sci_1, sci_3, and scif input/output, or general i/o port pins. the relationship between register setting values and pin functions are as follows. ? p57/ irq15 /pwx1 the pin function is switched as shown below acco rding to the combinatio n of the oeb bit in dacr of pwmx and the p57ddr bit. when the iss15 bit in issr16 is cleared to 0 and the irq15e bit in ier16 of the interrupt controller is set to 1, this pin can be used as the irq15 input pin. to use this pin as the irq15 input pin, clear the p57ddr bit to 0. oeb 0 1 p57ddr 0 1 x p57 input pin pin function irq15 input pin p57 output pin pwx1 output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 199 of 862 rej09b0429-0100 ? p56/ irq14 /pwx0 the pin function is switched as shown below acco rding to the combinatio n of the oea bit in dacr of pwmx and the p56ddr bit. when the iss14 bit in issr16 is cleared to 0 and the irq14e bit in ier16 of the interrupt controller is set to 1, this pin can be used as the irq14 input pin. to use this pin as the irq14 input pin, clear the p56ddr bit to 0. oea 0 1 p56ddr 0 1 x p56 input pin pin function irq14 input pin p56 output pin pwx0 output pin [legend] x: don't care. ? p55/ irq13 /rxd3 the pin function is switched as shown below acco rding to the combination of the re bit in scr and the smif bit in scmr of sci_3, and the p55ddr bit. when the iss13 bit in issr16 is cleared to 0 and the irq13e bit in ier16 of the interrupt controller is set to 1, this pin can be used as the irq13 input pin. to use this pin as the irq13 input pin, clear the p55ddr bit to 0. re 0 1 smif 0 1 p55ddr 0 1 x p55 input pin pin function irq13 input pin p55 output pin rxd3 input pin rxd3 input/output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 200 of 862 rej09b0429-0100 ? p54/ irq12 /txd3 the pin function is switched as shown below acco rding to the combination of the te bit in scr and the smif bit in scmr of sci_3, and the p54ddr bit. when the iss12 bit in issr16 is cleared to 0 and the irq12e bit in ier16 of the interrupt controller is set to 1 this pin can be used as the irq12 input pin. to use this pin as the irq12 input pin, clear the p54ddr bit to 0. te 0 x 0 x 1 smif 0 1 0 1 0 p54ddr 0 1 x p54 input pin pin function irq12 input pin p54 output pin txd3 output pin [legend] x: don't care. ? p53/ irq11 /rxd1 the pin function is switched as shown below acco rding to the combination of the re bit in scr and the smif bit in scmr of sci_1, and the p53ddr bit. when the iss11 bit in issr16 is cleared to 0 and the irq11e bit in ier16 of the interrupt controller is set to 1, this pin can be used as the irq11 input pin. to use as the irq11 input pin, clear the p53ddr bit to 0. re 0 1 smif 0 1 p53ddr 0 1 x p53 input pin pin function irq11 input pin p53 output pin rxd1 input pin rxd3 input/output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 201 of 862 rej09b0429-0100 ? p52/ irq10 /txd1 the pin function is switched as shown below acco rding to the combination of the te bit in scr and the smif bit in scmr of sci_1, and the p52ddr bit. when the iss10 bit in issr16 is cleared to 0 and the irq10e bit in ier16 of the interrupt controller is set to 1, this pin can be used as the irq10 input pin. to use as the irq10 input pin, clear the p52ddr bit to 0. te 0 x 0 x 1 smif 0 1 0 1 0 p52ddr 0 1 x p52 input pin pin function irq10 input pin p52 output pin txd1 output pin [legend] x: don't care. ? p51/ irq9 /rxdf the pin function is switched as shown be low according to the combination of the enable/disable setting of the scif and the p51ddr bit. when the iss9 bit in issr16 is cleared to 0 and the irq9e bit in ier16 of the interrupt controller is set to 1, this pin can be used as the irq9 input pin. to use as the irq9 input pin, clear the p51ddr bit to 0. scif disabled enabled p51ddr 0 1 x p51 input pin pin function irq9 input pin p51 output pin rxdf input pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 202 of 862 rej09b0429-0100 ? p50/ irq8 /txdf the pin function is switched as shown be low according to the combination of the enable/disable setting of the scif and the p50ddr bit. when the iss8 bit in issr16 is cleared to 0 and the irq8e bit in ier16 of the interrupt controller is set to 1, this pin can be used as the irq8 input pin. to use as the irq8 input pin, clear the p50ddr bit to 0. scif disabled enabled p50ddr 0 1 x p50 input pin pin function irq8 input pin p50 output pin txdf output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 203 of 862 rej09b0429-0100 8.6 port 6 port 6 is an 8-bit i/o port. port 6 pins can also function as the bidirectional data bus and scif control input/output pins. the pin functions change according to the operating mode. in addition, port 6 pins can also be used as the extended data bus pins (d7 to d0). port 6 has the following registers. ? port 6 data direction register (p6ddr) ? port 6 data register (p6dr) ? port 6 pull-up mos control register (p6pcr) ? noise canceler enable register (p6nce) ? noise canceler mode control register (p6ncmc) ? noise cancel cycle setting register (nccs) 8.6.1 port 6 data di rection register (p6ddr) the individual bits of p6ddr specify input or output for the pins of port 6. bit bit name initial value r/w description 7 p67ddr 0 w 6 p66ddr 0 w 5 p65ddr 0 w 4 p64ddr 0 w 3 p63ddr 0 w 2 p62ddr 0 w 1 p61ddr 0 w 0 p60ddr 0 w ? normal extended mode (16-bit bus) these bits have no effect on operation. ? other modes if port 6 pins are specified for use as the general i/o port, the corresponding pins function as output port when the p6ddr bits are set to 1, and as input port when cleared to 0.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 204 of 862 rej09b0429-0100 8.6.2 port 6 data register (p6dr) p6dr stores output data for the port 6 pins. bit bit name initial value r/w description 7 p67dr 0 r/w 6 p66dr 0 r/w 5 p65dr 0 r/w 4 p64dr 0 r/w 3 p63dr 0 r/w 2 p62dr 0 r/w 1 p61dr 0 r/w 0 p60dr 0 r/w ? normal extended mode (16-bit data bus) since the corresponding pins function as bidirectional data bus pins, the value in these bits has no effect on operation. if this register is read, the p6dr values are read for the bits with the corresponding p6ddr bits set to 1. for the bits with the corresponding p6ddr bits cleared to 0, 1 is read. ? other modes these bits store output data for the port 6 pins that are used as the general output port. if this register is read, the p6dr values are read for the bits with the corresponding p6ddr bits set to 1. for the bits with the corresponding p6ddr bits cleared to 0, the pin states are read. 8.6.3 port 6 pull-up mos control register (p6pcr) p6pcr controls the port 6 built-in input pull-up moss. bit bit name initial value r/w description 7 p67pcr 0 r/w 6 p66pcr 0 r/w 5 p65pcr 0 r/w 4 p64pcr 0 r/w 3 p23pcr 0 r/w 2 p62pcr 0 r/w 1 p61pcr 0 r/w 0 p60pcr 0 r/w ? normal extended mode (16-bit bus) this register has no effect on operation. ? other modes when the pins are in the input state, the corresponding input pull-up mos is turned on when a p6pcr bit is set to 1.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 205 of 862 rej09b0429-0100 8.6.4 noise canceler enable register (p6nce) p6nce enables or disables the noi se canceler circuit at port 6. bit bit name initial value r/w description 7 p67nce 0 r/w 6 p66nce 0 r/w 5 p65nce 0 r/w 4 p64nce 0 r/w 3 p63nce 0 r/w 2 p62nce 0 r/w 1 p61nce 0 r/w 0 p60nce 0 r/w enables the noise canceler circuit for the corresponding pin and the pin state is fetched into p6dr at the sampling cycle set by nccs. the operation changes according to the other control bits. see section 8.6.7, pin functions, for details. 8.6.5 noise canceler mode control register (p6ncmc) p6ncmc controls whether 1 or 0 is expected for the input signal to port 6 in bit units. bit bit name initial value r/w description 7 p67ncmc 0 r/w 6 p66ncmc 0 r/w 5 p65ncmc 0 r/w 4 p64ncmc 0 r/w 3 p63ncmc 0 r/w 2 p62ncmc 0 r/w 1 p61ncmc 0 r/w 0 p60ncmc 0 r/w 1 expected: 1 is stored in the port data register while 1 is input stably. 0 expected: 0 is stored in the port data register while 0 is input stably.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 206 of 862 rej09b0429-0100 8.6.6 noise canceler cycle setting register (nccs) nccs controls the sampling cycle of the noise cancelers. bit bit name initial value r/w description 7 to 3 ? undefined r/w reserved undefined value is read from these bits. 2 1 0 ncck2 ncck1 ncck0 0 0 0 r/w r/w r/w these bits set the sampling cycle of the noise cancelers. when = 34 mhz 000: 0.06 s /2 100: 963.8 s /32768 001: 0.94 s /32 101: 1.9 ms /65536 010: 15.1 s /512 110: 3.9 ms /131072 011: 240.9 s /8192 111: 7.7 ms /262144 latch ? t ? t sampling clock selection /2, /32, /512, /8192, /32768, /65536, /131072, /262144 pin input sampling clock match detection circuit port data register latch latch figure 8.1 noise canceler circuit
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 207 of 862 rej09b0429-0100 p6n input 1 expected p6ndr 0 expected p6ndr (n = 7 to 0) figure 8.2 noise canceler operation 8.6.7 pin functions (1) normal extended mode ? 16-bit bus mode the operation is automatically set to function as bidirectional data bus pins. ? 8-bit bus mode the operation is the same as that in single-chip mode. (2) address-data multiplex extended mode the operation is the same as that in single-chip mode. (3) single-chip mode port 6 pins can operate as the pwmx output, scif control input/output, or general i/o port pins. the relationship between register setting values and pin functions are as follows.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 208 of 862 rej09b0429-0100 ? p67/db15 the pin function is switched as shown below acco rding to the p67ddr bit and p67nce bit. p67ddr 0 1 p67nce 0 1 x pin function p67 input pin db15 input pin p67 output pin [legend] x: don't care. ? p66/db14 the pin function is switched as shown below acco rding to the p66ddr bit and p66nce bit. p66ddr 0 1 p66nce 0 1 x pin function p66 input pin db14 input pin p66 output pin [legend] x: don't care. ? p65/db13/ rts the pin function is switched as shown be low according to the combination of the enable/disable setting of the scif and the p65ddr bit and p65nce bit. scif disabled enabled p65ddr 0 1 x p65nce 0 1 x x pin function p65 input pin db13 input pin p65 output pin rts output pin [legend] x: don't care. ? p64/db12/ cts the pin function is switched as shown be low according to the combination of the enable/disable setting of the scif and the p64ddr bit and p64nce bit. scif disabled enabled p64ddr 0 1 x p64nce 0 1 x x pin function p64 input pin db12 input pin p64 output pin cts input pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 209 of 862 rej09b0429-0100 ? p63/db11 the pin function is switched as shown below acco rding to the p63ddr bit and p63nce bit. p63ddr 0 1 p63nce 0 1 x pin function p63 input pin db11 input pin p63 output pin [legend] x: don't care. ? p62/db10 the pin function is switched as shown below acco rding to the p62ddr bit and p62nce bit. p62ddr 0 1 p62nce 0 1 x pin function p62 input pin db10 input pin p62 output pin [legend] x: don't care. ? p61/db9 the pin function is switched as shown below acco rding to the p61ddr bit and p61nce bit. p61ddr 0 1 p61nce 0 1 x pin function p61 input pin db9 input pin p61 output pin [legend] x: don't care. ? p60/db8 the pin function is switched as shown below acco rding to the p60ddr bit and p60nce bit. p60ddr 0 1 p60nce 0 1 x pin function p60 input pin db8 input pin p60 output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 210 of 862 rej09b0429-0100 8.6.8 port 6 input pull-up mos port 6 has built-in input pull-up moss that can be controlled by software. table 8.5 summarizes the input pull-up mos states. table 8.5 port 6 input pull-up mos states reset hardware standby mode software standby mode in other operations off off on/off on/off [legend] off: always off. on/off: on when p6ddr = 0 and p6pcr = 1; otherwise off.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 211 of 862 rej09b0429-0100 8.7 port 7 port 7 is an 8-bit input port. port 7 pins can also function as the a/d converter analog input and interrupt input pins. port 7 has the following register. ? port 7 input data register (p7pin) 8.7.1 port 7 input data register (p7pin) p7pin indicates the states of the port 7 pins. bit bit name initial value r/w description 7 p77pin undefined * r 6 p76pin undefined * r 5 p75pin undefined * r 4 p74pin undefined * r 3 p73pin undefined * r 2 p72pin undefined * r 1 p71pin undefined * r 0 p70pin undefined * r when this register is read, the pin states are read. since this register is allocated to the same address as pbddr, writing to this register writes data to pbddr and the port b setting is changed. note: * the initial values are determined in accordance with the pin states of p77 to p70.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 212 of 862 rej09b0429-0100 8.7.2 pin functions ? p77/ exirq7 /an7 the pin function is switched as shown below acco rding to the combination of the ch2 to ch0 bits in adcsr of the a/d converter and the iss7 bit in issr of the interrupt controller. do not set these bits to other values than those shown in the following table. setting the iss7 bit in issr makes the pin to function as the exirq7 input pin. ch2 to ch0 b'111 other than b'111 iss7 0 0 1 pin function an7 input pin p77 input pin exirq7 input pin ? p76/ exirq6 /an6 the pin function is switched as shown below acco rding to the combina tion of the scane bit in adcr and the ch2 to ch0 bits in adcsr of the a/d converter, and the iss6 bit in issr of the interrupt controller. do not set these bits to other values than those shown in the following table. scane 0 1 ch2 to ch0 b'110 other than b'110 b'110 to b'111 b'000 to b'101 iss6 0 0 1 0 0 1 pin function an6 input pin p76 input pin exirq6 input pin an6 input pin p76 input pin exirq6 input pin
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 213 of 862 rej09b0429-0100 ? p75/ exirq5 /an5 the pin function is switched as shown below acco rding to the combina tion of the scane bit in adcr and the ch2 to ch0 bits in adcsr of the a/d converter, and the iss5 bit in issr of the interrupt controller. do not set these bits to other values than those shown in the following table. scane 0 1 ch2 to ch0 b'101 other than b'101 b'101 to b'111 b'000 to b'100 iss5 0 0 1 0 0 1 pin function an5 input pin p75 input pin exirq5 input pin an5 input pin p75 input pin exirq5 input pin ? p74/ exirq4 /an4 the pin function is switched as shown below acco rding to the combina tion of the scane bit in adcr and the ch2 to ch0 bits in adcsr of the a/d converter, and the iss4 bit in issr of the interrupt controller. do not set these bits to other values than those shown in the following table. scane 0 1 ch2 to ch0 b'100 other than b'100 b'100 to b'111 b'000 to b'011 iss4 0 0 1 0 0 1 pin function an4 input pin p74 input pin exirq4 input pin an4 input pin p74 input pin exirq4 input pin
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 214 of 862 rej09b0429-0100 ? p73/ exirq3 /an3 the pin function is switched as shown below acco rding to the combination of the scane and scane bits in adcr and the ch2 to ch0 bits in adcsr of the a/d converter, and the iss3 bit in issr of the interrupt controller. do not set these bits to other values than those shown in the following table. scane 0 1 scans x 0 1 ch2 to ch0 b'011 other than b'011 b'011 other than b'011 b'011 to b'111 b'000 to b'010 iss3 0 0 1 0 0 1 0 0 1 pin function an3 input pin p73 input pin exirq3 input pin an3 input pin p73 input pin exirq3 input pin an3 input pin p73 input pin exirq3 input pin [legend] x: don't care. ? p72/ exirq2 /an2 the pin function is switched as shown below acco rding to the combination of the scane and scane bits in adcr and the ch2 to ch0 bits in adcsr of the a/d converter, and the iss2 bit in issr of the interrupt controller. do not set these bits to other values than those shown in the following table. scane 0 1 scans x 0 1 ch2 to ch0 b'010 other than b'010 b'010 to b'011 other than b'010 to b'011 b'010 to b'111 b'000 to b'001 iss2 0 0 1 0 0 1 0 0 1 pin function an2 input pin p72 input pin exirq2 input pin an2 input pin p72 input pin exirq2 input pin an2 input pin p72 input pin exirq2 input pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 215 of 862 rej09b0429-0100 ? p71/ exirq1 /an1 the pin function is switched as shown below acco rding to the combination of the scane and scans bits in adcr and the ch2 to ch0 bits in adcsr of the a/d converter, and the iss1 bit in issr of the interrupt controller. do not set these bits to other values than those shown in the following table. scane 0 1 scans x 0 1 ch2 to ch0 b'001 other than b'001 b'001 to b'011 other than b'001 to b'011 b'001 to b'111 b'000 iss1 0 0 1 0 0 1 0 0 1 pin function an1 input pin p71 input pin exirq1 input pin an1 input pin p71 input pin exirq1 input pin an1 input pin p71 input pin exirq1 input pin [legend] x: don't care. ? p70/ exirq0 /an0 the pin function is switched as shown below acco rding to the combination of the scane and scans bits in adcr and the ch2 to ch0 bits in adcsr of the a/d converter, and the iss0 bit in issr of the interrupt controller. do not set these bits to other values than those shown in the following table. scane 0 1 scans x 0 1 ch2 to ch0 b'000 other than b'000 b'000 to b'011 other than b'000 to b'011 b'000 to b'111 iss0 0 0 1 0 0 1 0 pin function an0 input pin p70 input pin exirq0 input pin an0 input pin p70 input pin exirq0 input pin an0 input pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 216 of 862 rej09b0429-0100 8.8 port 8 port 8 is an 8-bit i/o port. port 8 pins can also function as the a/d converter external trigger input, sci_1 and sci_3 input/output, iic_0 and iic_1 input/output, and interrupt input pins. pins 83 to 80 perform the nmos push-pull output. port 8 has the following registers. ? port 8 data direction register (p8ddr) ? port 8 data register (p8dr) 8.8.1 port 8 data di rection register (p8ddr) the individual bits of p8ddr specify input or output for the port 8 pins. bit bit name initial value r/w description 7 p87ddr 0 w 6 p86ddr 0 w 5 p85ddr 0 w 4 p84ddr 0 w 3 p83ddr 0 w 2 p82ddr 0 w 1 p81ddr 0 w 0 p80ddr 0 w if port 8 pins are specified for use as the general i/o port, the corresponding pins function as output port when the p8ddr bits are set to 1, and as input port when cleared to 0. since this register is allocated to the same address as pbpin, states of the port 8 pins are when this register is read.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 217 of 862 rej09b0429-0100 8.8.2 port 8 data register (p8dr) p8dr stores output data for the port 8 pins. bit bit name initial value r/w description 7 p87dr 0 r/w 6 p86dr 0 r/w 5 p85dr 0 r/w 4 p84dr 0 r/w 3 p83dr 0 r/w 2 p82dr 0 r/w 1 p81dr 0 r/w 0 p80dr 0 r/w p8dr stores output data for the port 8 pins that are used as the general output port. if this register is read, the p8dr values are read for the bits with the corresponding p8ddr bits set to 1. for the bits with the corresponding p8ddr bits cleared to 0, the pin states are read. 8.8.3 pin functions the relationship between register setting values and pin functions are as follows. ? p87/ exirq15 / adtrg the pin function is switched as shown below according to the p87ddr bit. when the trgs1 and extrgs bits are both set to 1 and the trgs0 bit is cleared to 0 in adcr of the a/d converter, this pin can be used as the adtrg input pin. when the iss15 bit in issr16 is set to 1, this pin can be used as the exirq15 input pin. to use this pin as the exirq15 input pin, clear the p87ddr bit to 0. p87ddr 0 1 p87 input pin pin function exirq15 input pin/ adtrg input pin p87 output pin
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 218 of 862 rej09b0429-0100 ? p86/ exirq14 the pin function is switched as shown below according to the p86ddr bit. when the iss14 bit in issr16 is set to 1, this pin can be used as the exirq14 input pin. to use this pin as the exirq14 input pin, clear the p86ddr bit to 0. p86ddr 0 1 p86 input pin pin function exirq14 input pin p86 output pin ? p85/ exirq13 /sck1 the pin function is switched as shown belo w according to the combination of the c/ a bit in smr of sci_1, the cke1 and cke0 bits in scr, and the p85ddr bit. when the iss13 bit in issr16 is set to 1, this pin can be used as the exirq13 input pin. to use this pin as the exirq13 input pin, clear the p85ddr bit to 0. cke1 0 1 c/ a 0 1 x cke0 0 1 x x p85ddr 0 1 x x x p85 input pin pin function exirq13 input pin p85 output pin sck1 output pin sck1 output pin sck1 input pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 219 of 862 rej09b0429-0100 ? p84/ exirq12 /sck3 the pin function is switched as shown belo w according to the combination of the c/ a bit in smr of sci_3, the cke1 and cke0 bits in scr, and the p84ddr bit. when the iss12 bit in issr16 is set to 1, this pin can be used as the exirq12 input pin. to use this pin as the exirq12 input pin, clear the p84ddr bit to 0. cke1 0 1 c/ a 0 1 x cke0 0 1 x x p84ddr 0 1 x x x p84 input pin pin function exirq12 input pin p84 output pin sck3 output pin sck3 output pin sck3 input pin [legend] x: don't care. ? p83/sda1 the pin function is switched as shown below acco rding to the combination of the ice bit in iccr of iic_1 and the p83ddr bit. when this pin is used as the p83 output pin, the output format is nmos push-pull output. the output format for sda1 is nmos open-drain output, which allows direct bus drive. ice 0 1 p83ddr 0 1 x pin function p83 input pin p83 output pin sda1 input/output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 220 of 862 rej09b0429-0100 ? p82/scl1 the pin function is switched as shown below acco rding to the combination of the ice bit in iccr of iic_1 and the p82ddr bit. when this pin is used as the p82 output pin, the output format is nmos push-pull output. the output format for scl1 is nmos open-drain output, which allows direct bus drive. ice 0 1 p82ddr 0 1 x pin function p82 input pin p82 output pin scl1 input/output pin [legend] x: don't care. ? p81/sda0 the pin function is switched as shown below acco rding to the combination of the ice bit in iccr of iic_0 and the p81ddr bit. when this pin is used as the p81 output pin, the output format is nmos push-pull output. the output format for sda0 is nmos open-drain output, which allows direct bus drive. ice 0 1 p81ddr 0 1 x pin function p81 input pin p81 output pin sda0 input/output pin [legend] x: don't care. ? p80/scl0 the pin function is switched as shown below acco rding to the combination of the ice bit in iccr of iic_0 and the p80ddr bit. when this pin is used as the p80 output pin, the output format is nmos push-pull output. the output format for scl0 is nmos open-drain output, which allows direct bus drive. ice 0 1 p80ddr 0 1 x pin function p80 input pin p80 output pin scl0 input/output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 221 of 862 rej09b0429-0100 8.9 port 9 port 9 is an 8-bit i/o port. port 9 pins can also function as the bus control input/output and system clock output pins. the pin functions change according to the operating mode. port 9 has the following registers. ? port 9 data direction register (p9ddr) ? port 9 data register (p9dr) 8.9.1 port 9 data di rection register (p9ddr) the individual bits of p9ddr specify input or output for the port 9 pins. bit bit name initial value r/w description 7 p97ddr 0 w 6 p96ddr 0 w 5 p95ddr 0 w 4 p94ddr 0 w 3 p93ddr 0 w 2 p92ddr 0 w 1 p91ddr 0 w 0 p90ddr 0 w [p97ddr, p95ddr to p90ddr] if port 9 pins are specified for use as the general i/o port, the corresponding pins function as output port when the p97ddr, and p95ddr to p90ddr bits are set to 1, and as input port when cleared to 0. [p96ddr] the corresponding port 9 pin functions as the system clock output pin ( ) when this bit is set to 1, and as the general i/o port when cleared to 0.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 222 of 862 rej09b0429-0100 8.9.2 port 9 data register (p9dr) p9dr stores output data for the port 9 pins. bit bit name initial value r/w description 7 p97dr 0 r/w 6 p96dr undefined * r/w 5 p95dr 0 r/w 4 p94dr 0 r/w 3 p93dr 0 r/w 2 p92dr 0 r/w 1 p91dr 0 r/w 0 p90dr 0 r/w p9dr stores output data for the port 9 pins that are used as the general output port. if this register is read, the p9dr values are read for the bits with the corresponding p9ddr bits set to 1. for the bits with the corresponding p9ddr bits cleared to 0, the pin states are read. note: * the initial value is determined in accordance with the pin state of p96. 8.9.3 pin functions the relationship between register setting values and pin functions are as follows. ? p97/ wait / cs256 the pin function is switched as shown belo w according to the operating mode and the combination of the cs256e bit in syscr, the wms1 bit in wscr, the wms21 bit in wscr2, and the p97ddr bit. operating mode extended mode single-chip mode wms1, wms21 all 0 either bit is 1 x cs256e 0 1 x x p97ddr 0 1 x x 0 1 pin function p97 input pin p97 output pin cs256 output pin wait input pin p97 input pin p97 output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 223 of 862 rej09b0429-0100 ? p96/ /excl the pin function is switched as shown below acco rding to the combination of the excle bit in lpwrcr and the p96ddr bit. p96ddr 0 1 excle 0 1 x pin function p96 input pin excl input pin output pin [legend] x: don't care. ? p95/ as / ios the pin function is switched as shown belo w according to the operating mode and the combination of the iose bit in syscr and the p95ddr bit. operating mode extended mode single-chip mode p95ddr x 0 1 iose 0 1 x x pin function as output pin ios output pin p95 input pin p95 output pin [legend] x: don't care. ? p94/ hwr the pin function is switched as shown belo w according to the operating mode and the p94ddr bit. operating mode extended mode single-chip mode p94ddr x 0 1 pin function hwr output pin p94 input pin p94 output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 224 of 862 rej09b0429-0100 ? p93 the pin function is switched as shown belo w according to the operating mode and the p93ddr bit. operating mode extended mode single-chip mode p93ddr x 0 1 pin function rd output pin p93 input pin p93 output pin [legend] x: don't care. ? p92/ hbe the pin function is switched as shown below acco rding to the operating mode, the obe bit in ptcnt0, and the p92ddr bit. operating mode extended mode single-chip mode obe 0 1 x p92ddr 0 1 x 0 1 pin function p92 input pin p92 output pin hbe output pin p92 input pin p92 output pin [legend] x: don't care. ? p91/ ah the pin function is switched as shown belo w according to the operating mode, the admxe bit in syscr2, and the p91ddr bit. operating mode extended mode single-chip mode admxe 0 1 x p91ddr 0 1 x 0 1 pin function p91 input pin p91 output pin ah output pin p91 input pin p91 output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 225 of 862 rej09b0429-0100 ? p90/ lwr / lbe the pin function is switched as shown below according to the operating mode, the abw and abw256 bits in wscr, the obe bit in ptcnt0, and the p90ddr bit. operating mode extended mode single-chip mode abw, abw256 all 1 either bit is 0 x obe 0 1 x p90ddr 0 1 x 0 1 pin function p90 input pin p90 output pin lwr output pin lbe output pin p90 input pin p90 output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 226 of 862 rej09b0429-0100 8.10 port a port a is an 8-bit i/o port. port a pins can also function as the address output and event counter input pins. port a has the foll owing registers. paddr and papin are allocated to the same address. ? port a data direction register (paddr) ? port a output data register (paodr) ? port a input data register (papin) 8.10.1 port a data di rection register (paddr) the individual bits of paddr specify input or output for the port a pins. bit bit name initial value r/w description 7 pa7ddr 0 w 6 pa6ddr 0 w 5 pa5ddr 0 w 4 pa4ddr 0 w 3 pa3ddr 0 w 2 pa2ddr 0 w 1 pa1ddr 0 w 0 pa0ddr 0 w when set to 1, the corresponding pins function as output port pins; when cleared to 0, function as input port pins. as the address of this register is the same as that of papin, reading from this register indicates the state of port a.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 227 of 862 rej09b0429-0100 8.10.2 port a output data register (paodr) paodr stores output data for the port a pins. bit bit name initial value r/w description 7 pa7odr 0 r/w 6 pa6odr 0 r/w 5 pa5odr 0 r/w 4 pa4odr 0 r/w 3 pa3odr 0 r/w 2 pa2odr 0 r/w 1 pa1odr 0 r/w 0 pa0odr 0 r/w paodr stores output data for the port a pins that are used as the general output port. 8.10.3 port a input data register (papin) papin indicates the states of the port a pins. bit bit name initial value r/w description 7 pa7pin undefined * r 6 pa6pin undefined * r 5 pa5pin undefined * r 4 pa4pin undefined * r 3 pa3pin undefined * r 2 pa2pin undefined * r 1 pa1pin undefined * r 0 pa0pin undefined * r pin states are read from this register. as the address of this register is the same as that of paddr, writing to this register changes the settings of port a, that have been written to paddr. note: the initial values are determined in accordance with the pin states of pa7 to pa0.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 228 of 862 rej09b0429-0100 8.10.4 pin functions the relationship between the operating mode, register setting values, and pin functions are as follows. (1) normal extended mode port a pins can function as address output, interrupt input, event counter input, or i/o port pins, and input or output can be specified in bit units. address 18 and address 13 in the following tables are expressed by the following logical expressions according to the control bits of the bus controller or other module. address 18 = 1: adfulle address 13 = 1: adfulle ? cs256e ? iose ? pa7/event7/a23, pa6/event6 /a22, pa5/event5/a21, pa4/event4/a20, pa3/even t3/a19, pa2/event2/a18 the pin function is switched as shown below according to the setting of address 18 and the panddr bit. when using the pin as an even t input pin, clear the panddr bit to 0. though the settings for the event input pin have been made, set the panddr bit to 1 when using the pin as the pan or am output pin. panddr 0 1 1 address 18 1 pan input pin pin function eventn input pin pan output pin am output pin [legend] n = 7 to 2, m = 23 to 18
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 229 of 862 rej09b0429-0100 ? pa1/event1/a17, pa0/event0/a16 the pin function is switched as shown below according to the setting of address 13 and the panddr bit. when using the pin as an even t input pin, clear the panddr bit to 0. though the settings for the event input pin have been made, set the panddr bit to 1 when using the pin as the pan or am output pin. panddr 0 1 address 13 1 0 pan input pin pin function eventn input pin pan output pin am output pin [legend] n = 1, 0; m = 17, 16 (2) single-chip mode and address-data multiplex extended mode port a pins can function as the event counter input pins. ? pa7/event7, pa6/event6, pa5/event5, pa4/event4, pa3/event3, pa2/event2, pa1/event1, pa0/event0 the pin function is switched as shown below according to the panddr bit. though the settings for the event input pin have been made, set the panddr bit to 1 to use the pin as the pan output pin. panddr 0 1 pan input pin pin function eventn input pin pan output pin [legend] n = 7 to 0
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 230 of 862 rej09b0429-0100 8.10.5 input pull-up mos port a has built-in input pull-up moss that can be controlled by software. this input pull-up mos can be used in any operating mode, and can be specified as on or off on a bit-by-bit basis. panddr 0 1 panodr 1 0 x pan pull-up mos on off off [legend] n = 7 to 0, x: don't care. the input pull-up mos is in the off state after a reset and in hardware standby mode. the prior state is retained in software standby mode. table 8.6 summarizes the input pull-up mos states. table 8.6 input pull-up mos states reset hardware standby mode software standby mode in other operations off off on/off on/off [legend] off: always off. on/off: on when paddr = 0 and paodr = 1; otherwise off.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 231 of 862 rej09b0429-0100 8.11 port b port b is an 8-bit i/o port. port b pins can also function as the event counter input pins. port b has the following registers. ? port b data direction register (pbddr) ? port b output data register (pbodr) ? port b input data register (pbpin) 8.11.1 port b data di rection register (pbddr) the individual bits of pbddr specify input or output for the pins of port b. bit bit name initial value r/w description 7 pb7ddr 0 w 6 pb6ddr 0 w 5 pb5ddr 0 w 4 pb4ddr 0 w 3 pb3ddr 0 w 2 pb2ddr 0 w 1 pb1ddr 0 w 0 pb0ddr 0 w when set to 1, the corresponding pins function as output port pins; when cleared to 0, function as input port pins.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 232 of 862 rej09b0429-0100 8.11.2 port b output data register (pbodr) pbodr stores output data for the port b pins. bit bit name initial value r/w description 7 pb7dr 0 r/w 6 pb6dr 0 r/w 5 pb5dr 0 r/w 4 pb4dr 0 r/w 3 pb3dr 0 r/w 2 pb2dr 0 r/w 1 pb1dr 0 r/w 0 pb0dr 0 r/w pbodr stores output data for the port b pins that are used as the general output port. 8.11.3 port b input data register (pbpin) pbpin indicates the states of the port b pins. bit bit name initial value r/w description 7 pb7pin undefined * r 6 pb6pin undefined * r 5 pb5pin undefined * r 4 pb4pin undefined * r 3 pb3pin undefined * r 2 pb2pin undefined * r 1 pb1pin undefined * r 0 pb0pin undefined * r when this register is read, the pin states are read. since this register is allocated to the same address as p8ddr, writing to this register writes data to p8ddr and the port 8 setting is changed. note: * the initial values are determined in accordance with the pin states of pb7 to pb0.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 233 of 862 rej09b0429-0100 8.11.4 pin functions ? pb7/event15, pb6/even t14, ? , pb0/event8 the pin function is switched as shown below acco rding to the pbnddr bit. when using this pin as the event input pin, clear the pbnddr bit to 0. pbnddr 0 1 event counter disabled enabled x pin function pbn input pin eventm input pin pbn output pin [legend] n = 7 to 0, m = 15 to 8, x: don't care. note: * see section 7.3, dtc event counter, for the event counter settings.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 234 of 862 rej09b0429-0100 8.12 port c port c is an 8-bit i/o port. port c pins can also function as the pwmx output, and iic_2, iic_3, and iic_4 input/output pins. the output format of ports c0 to c5 is nmos push-pull output. port c has the following registers. ? port c data direction register (pcddr) ? port c output data register (pcodr) ? port c input data register (pcpin) 8.12.1 port c data di rection register (pcddr) the individual bits of pcddr specify input or output for the port c pins. bit bit name initial value r/w description 7 pc7ddr 0 w 6 pc6ddr 0 w 5 pc5ddr 0 w 4 pc4ddr 0 w 3 pc3ddr 0 w 2 pc2ddr 0 w 1 pc1ddr 0 w 0 pc0ddr 0 w when set to 1, the corresponding pins function as output port pins; when cleared to 0, function as input port pins. since this register is allocated to the same address as pcpin, states of the port c pins are returned when this register is read.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 235 of 862 rej09b0429-0100 8.12.2 port c output data register (pcodr) pcodr stores output data for the port c pins. bit bit name initial value r/w description 7 pc7odr 0 r/w 6 pc6odr 0 r/w 5 pc5odr 0 r/w 4 pc4odr 0 r/w 3 pc3odr 0 r/w 2 pc2odr 0 r/w 1 pc1odr 0 r/w 0 pc0odr 0 r/w the pcodr register stores the output data for the pins that are used as the general output port. 8.12.3 port c input data register (pcpin) pcpin indicates the pin states of port c. bit bit name initial value r/w description 7 pc7pin undefined * r 6 pc6pin undefined * r 5 pc5pin undefined * r 4 pc4pin undefined * r 3 pc3pin undefined * r 2 pc2pin undefined * r 1 pc1pin undefined * r 0 pc0pin undefined * r when this register is read, the pin states are read. since this register is allocated to the same address as pcddr, writing to this register writes data to pcddr and the port c setting is changed. note: the initial values are determined in accordance with the states of pc7 to pc0 pins.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 236 of 862 rej09b0429-0100 8.12.4 pin functions port c pins can also function as the pwmx output and iic_2, iic_3, and iic_4 input/output pins. the relationship between register setting values and pin functions are as follows. ? pc7/pwx3 the pin function is switched as shown below acco rding to the combinatio n of the oeb bit in dacr of the pwmx and the pc7ddr bit. oeb 0 1 pc7ddr 0 1 x pin function pc7 input pin pc7 output pin pwx3 output pin [legend] x: don't care. ? pc6/pwx2 the pin function is switched as shown below acco rding to the combinatio n of the oea bit in dacr of the pwmx and the pc6ddr bit. oea 0 1 pc6ddr 0 1 x pin function pc6 input pin pc6 output pin pwx2 output pin [legend] x: don't care. ? pc5/sda4 the pin function is switched as shown below acco rding to the combination of the ice bit in iccr of the iic_4 and the pc5ddr bit. ice 0 1 pc5ddr 0 1 x pin function pc5 input pin pc5 output pin sda4 input/output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 237 of 862 rej09b0429-0100 ? pc4/scl4 the pin function is switched as shown below acco rding to the combination of the ice bit in iccr of the iic_4 and the pc4ddr bit. ice 0 1 pc4ddr 0 1 x pin function pc4 input pin pc4 output pin scl4 input/output pin [legend] x: don't care. ? pc3/sda3 the pin function is switched as shown below acco rding to the combination of the ice bit in iccr of the iic_3 and the pc3ddr bit. ice 0 1 pc3ddr 0 1 x pin function pc3 input pin pc3 output pin sda3 input/output pin [legend] x: don't care. ? pc2/scl3 the pin function is switched as shown below acco rding to the combination of the ice bit in iccr of the iic_3 and the pc2ddr bit. ice 0 1 pc2ddr 0 1 x pin function pc2 input pin pc2 output pin scl3 input/output pin [legend] x: don't care. ? pc1/sda2 the pin function is switched as shown below acco rding to the combination of the ice bit in iccr of the iic_2 and the pc1ddr bit. ice 0 1 pc1ddr 0 1 x pin function pc1 input pin pc1 output pin sda2 input/output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 238 of 862 rej09b0429-0100 ? pc0/scl2 the pin function is switched as shown below acco rding to the combination of the ice bit in iccr of the iic_2 and the pc0ddr bit. ice 0 1 pc0ddr 0 1 x pin function pc0 input pin pc0 output pin scl2 input/output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 239 of 862 rej09b0429-0100 8.13 port d port d is an 8-bit i/o port. port d pins can also function as the iic_5 input/output and lpc input/output pins. the output format of pd7 and pd6 pins is nmos push-pull output. port d has the following registers. ? port d data direction register (pdddr) ? port d output data register (pdodr) ? port d input data register (pdpin) 8.13.1 port d data di rection register (pdddr) the individual bits of pdddr specify input or output for the port d pins. bit bit name initial value r/w description 7 pd7ddr 0 w 6 pd6ddr 0 w 5 pd5ddr 0 w 4 pd4ddr 0 w 3 pd3ddr 0 w 2 pd2ddr 0 w 1 pd1ddr 0 w 0 pd0ddr 0 w if port d pins are specified for use as the general i/o port, the corresponding pins function as output port when the pdddr bits are set to 1, and as input port when cleared to 0. since this register is allocated to the same address as pdpin, the states of the port d pins are returned when this register is read.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 240 of 862 rej09b0429-0100 8.13.2 port d output data register (pdodr) pdodr stores output data for the port d pins. bit bit name initial value r/w description 7 pd7odr 0 r/w 6 pd6odr 0 r/w 5 pd5odr 0 r/w 4 pd4odr 0 r/w 3 pd3odr 0 r/w 2 pd2odr 0 r/w 1 pd1odr 0 r/w 0 pd0odr 0 r/w the pdodr register stores the output data for the pins that are used as the general output port. 8.13.3 port d input data register (pdpin) pdpin indicates the pin states of port d. bit bit name initial value r/w description 7 pd7pin undefined * r 6 pd6pin undefined * r 5 pd5pin undefined * r 4 pd4pin undefined * r 3 pd3pin undefined * r 2 pd2pin undefined * r 1 pd1pin undefined * r 0 pd0pin undefined * r when this register is read, the pin states are read. since this register is allocated to the same address as pdddr, writing to this register writes data to pdddr and the port d setting is changed. note: the initial values are determined in accordance with the states of pd7 to pd0 pins.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 241 of 862 rej09b0429-0100 8.13.4 pin functions port d pins can also function as the lpc input/output and iic_5 input/output pins. the relationship between register setting values and pin functions are as follows. the lpc is disabled when all of the bits lp c1e, lpc2e, and lpc3e in hicr0 and scife in hicr5 are cleared to 0. ? pd7/sda5 the pin function is switched as shown below acco rding to the combination of the ice bit in iccr of the iic_5 and the pd7ddr bit. ice 0 1 pd7ddr 0 1 x pin function pd7 input pin pd7 output pin sda5 input/output pin [legend] x: don't care. ? pd6/scl5 the pin function is switched as shown below acco rding to the combination of the ice bit in iccr of the iic_5 and the pd6ddr bit. ice 0 1 pd6ddr 0 1 x pin function pd6 input pin pd6 output pin scl5 input/output pin [legend] x: don't care. ? pd5/ lpcpd the pin function is switched as shown below acco rding to the pd5ddr bit. this pin can be used as the lpcpd input pin when the lpc is enabled. lpc disabled enabled pd5ddr 0 1 0 pin function pd5 input pin pd5 output pin lpcpd input pin
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 242 of 862 rej09b0429-0100 ? pd4/ clkrun the pin function is switched as shown below acco rding to the pd4ddr bit. this pin can be used as the clkrun input pin when the lpc is enabled. lpc disabled enabled pd4ddr 0 1 0 pin function pd4 input pin pd4 output pin clkrun input/output pin ? pd3/ga20 the pin function is switched as shown below acco rding to the combination of the fga20e bit in hicr0 of the lpc and the pd3ddr bit. fga20e 0 1 pd3ddr 0 1 0 pin function pd3 input pin pd3 output pin ga20 output pin ? pd2/ pme the pin function is switched as shown below acco rding to the combination of the pmee bit in hicr0 of the lpc and the pd2ddr bit. pmee 0 1 pd2ddr 0 1 0 pin function pd2 input pin pd2 output pin pme output pin ? pd1/ lsmi the pin function is switched as shown below accord ing to the combination of the lsmie bit in hicr0 of the lpc and the pd1ddr bit. lsmie 0 1 pd1ddr 0 1 0 pin function pd1 input pin pd1 output pin lsmi output pin
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 243 of 862 rej09b0429-0100 ? pd0/lsci the pin function is switched as shown below accord ing to the combination of the lscie bit in hicr0 of the lpc and the pd0ddr bit. lscie 0 1 pd0ddr 0 1 0 pin function pd0 input pin pd0 output pin lsci output pin 8.13.5 input pull-up mos port pins d5 to d0 have built-in input pull-up moss that can be controlled by software. this input pull-up mos can be used in any operating mode, and can be specified as on or off on a bit-by-bit basis. pdnddr 0 1 pdnodr 1 0 x pdn pull-up mos on off off [legend] n = 5 to 0, x: don't care. the input pull-up mos is in the off state after a reset and in hardware standby mode. the prior state is retained in software standby mode. table 8.7 summarizes the input pull-up mos states. table 8.7 port d input pull-up mos states reset hardware standby mode software standby mode in other operations off off on/off on/off [legend] off: always off. on/off: on when pdddr = 0 and pdodr = 1; otherwise off.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 244 of 862 rej09b0429-0100 8.14 port e port e is an 8-bit i/o port. port e pins can also function as the lpc input/output pins. port e has the following registers. ? port e data direction register (peddr) ? port e output data register (peodr) ? port e input data register (pepin) 8.14.1 port e data di rection register (peddr) the individual bits of peddr specify input or output for the port e pins. bit bit name initial value r/w description 7 pe7ddr 0 w 6 pe6ddr 0 w 5 pe5ddr 0 w 4 pe4ddr 0 w 3 pe3ddr 0 w 2 pe2ddr 0 w 1 pe1ddr 0 w 0 pe0ddr 0 w when set to 1, the corresponding pins function as output port pins; when cleared to 0, function as input port pins. since this register is allocated to the same address as pepin, states of the port e pins are returned when this register is read.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 245 of 862 rej09b0429-0100 8.14.2 port e output data register (peodr) peodr stores output data for the port e pins. bit bit name initial value r/w description 7 pe7odr 0 r/w 6 pe6odr 0 r/w 5 pe5odr 0 r/w 4 pe4odr 0 r/w 3 pe3odr 0 r/w 2 pe2odr 0 r/w 1 pe1odr 0 r/w 0 pe0odr 0 r/w the peodr register stores the output data for the pins that are used as the general output port. 8.14.3 port e input data register (pepin) pepin indicates the pin states of port e. bit bit name initial value r/w description 7 pe7pin undefined * r 6 pe6pin undefined * r 5 pe5pin undefined * r 4 pe4pin undefined * r 3 pe3pin undefined * r 2 pe2pin undefined * r 1 pe1pin undefined * r 0 pe0pin undefined * r when this register is read, the pin states are read. since this register is allocated to the same address as peddr, writing to this register writes data to peddr and the port e setting is changed. note: the initial value of these pins is determined in accordance with the state of pins pe7 to pe0.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 246 of 862 rej09b0429-0100 8.14.4 pin functions port e pins can also function as lpc input/output pins. the pin function is switched according to whether the lpc module is enabled or disabled. the lpc is disabled when all of the bits lpc1e, lpc2e, and lpc3e in hicr0 and scife in hicr5 are cleared to 0. ? pe7/ serirq the pin function is switched as shown below according to whether the lpc is enabled or disabled and the pe7ddr bit. lpc disabled enabled pe7ddr 0 1 x pin function pe7 input pin pe7 output pin serirq input/output pin [legend] x: don't care. ? pe6/ lclk the pin function is switched as shown below according to whether the lpc is enabled or disabled and the pe6ddr bit. lpc disabled enabled pe6ddr 0 1 x pin function pe6 input pin pe6 output pin lclk input pin [legend] x: don't care. ? pe5/ lreset the pin function is switched as shown below according to whether the lpc is enabled or disabled and the pe5ddr bit. lpc disabled enabled pe5ddr 0 1 x pin function pe5 input pin pe5 output pin lreset input pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 247 of 862 rej09b0429-0100 ? pe4/ lframe the pin function is switched as shown below according to whether the lpc is enabled or disabled and the pe4ddr bit. lpc disabled enabled pe4ddr 0 1 x pin function pe4 input pin pe4 output pin lframe input pin [legend] x: don't care. ? pe3/ lad3 the pin function is switched as shown below according to whether the lpc is enabled or disabled and the pe3ddr bit. lpc disabled enabled pe3ddr 0 1 x pin function pe3 input pin pe3 output pin lad3 input/output pin [legend] x: don't care. ? pe2/ lad2 the pin function is switched as shown below according to whether the lpc is enabled or disabled and the pe2ddr bit. lpc disabled enabled pe2ddr 0 1 x pin function pe2 input pin pe2 output pin lad2 input/output pin [legend] x: don't care. ? pe1/ lad1 the pin function is switched as shown below according to whether the lpc is enabled or disabled and the pe1ddr bit. lpc disabled enabled pe1ddr 0 1 x pin function pe1 input pin pe1 output pin lad1 input/output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 248 of 862 rej09b0429-0100 ? pe0/ lad0 the pin function is switched as shown below according to whether the lpc is enabled or disabled and the pe0ddr bit. lpc disabled enabled pe0ddr 0 1 x pin function pe0 input pin pe0 output pin lad0 input/output pin [legend] x: don't care.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 249 of 862 rej09b0429-0100 8.15 port f port f is a 4-bit i/o port. port f has the following registers. ? port f data direction register (pfddr) ? port f output data register (pfodr) ? port f input data register (pfpin) 8.15.1 port f data di rection register (pfddr) the individual bits of pfddr specify input or output for the port f pins. pfddr is initialized only by a system reset, and retains the value even if an internal reset signal of the wdt is generated. bit bit name initial value r/w description 7 to 4 ? ? ? reserved 3 2 1 0 pf3ddr pf2ddr pf1ddr pf0ddr 0 0 0 0 w w w w when set to 1, the corresponding pin functions as an output port pin; when cleared to 0, functions as an input port pin. since this register is allocated to the same address as pfpin, states of the port f pins are returned when this register is read. 8.15.2 port f output data register (pfodr) pfodr stores output data for the port f pins. pfodr is initialized only by a system reset, and retains the value even if an internal reset signal of the wdt is generated. bit bit name initial value r/w description 7 to 4 ? ? ? reserved undefined value is read from this bit. 3 2 1 0 pf3odr pf2odr pf1odr pf0odr 0 0 0 0 r/w r/w r/w r/w store the output data for the pins that are used as the general output port.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 250 of 862 rej09b0429-0100 8.15.3 port f input data register (pfpin) pfpin indicates the pin states of port f. bit bit name initial value r/w description 7 to 4 ? ? ? reserved undefined value is read from this bit. 3 2 1 0 pf3pin pf2pin pf1pin pf0pin undefined * undefined * undefined * undefined * r r r r when this register is read, the pin states are read. since this register is allocated to the same address as pfddr, writing to this register writes data to pfddr and the port f setting is changed. note: the initial value of these pins is determined in accordance with the state of pins pf3 to pf0. 8.15.4 pin functions port f is a 4-bit i/o port. the relationship between the register settings and the pin function is shown below. ? pf3/rs11, pf2/rs10, pf1/rs9, pf0/rs8 the pin function is switched as show n below according to the pfnddr bit. pfnddr 0 1 pin function pfn input pin pfn output pin [legend] n = 3 to 0
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 251 of 862 rej09b0429-0100 8.16 change of periph eral function pins the pin function assignments for the external interrupt inputs can be changed between multiplexed i/o ports. i/o port pins for external interrupt inputs are changed by the setting of issr16 and issr. a pin name of the peripheral function after the assignment has been changed is indicated by adding ?ex? at the head of the original pin name. in each peri pheral function description, the original pin name is used. 8.16.1 irq sense port select register 16 (issr16), irq sense port select register (issr) issr16 and issr select pins for the irq15 to irq0 inputs. ? issr16 bit bit name initial value r/w description 15 iss15 0 r/w 0: p57/ irq15 is selected 1: p87/ exirq15 is selected 14 iss14 0 r/w 0: p56/ irq14 is selected 1: p86/ exirq14 is selected 13 iss13 0 r/w 0: p55/ irq13 is selected 1: p85/ exirq13 is selected 12 iss12 0 r/w 0: p54/ irq12 is selected 1: p84/ exirq12 is selected 11 iss11 0 r/w 0: p53/ irq11 is selected 1: p83/ exirq11 is selected 10 iss10 0 r/w 0: p52/ irq10 is selected 1: p82/ exirq10 is selected 9 iss9 0 r/w 0: p51/ irq9 is selected 1: p81/ exirq9 is selected 8 iss8 0 r/w 0: p50/ irq8 is selected 1: p80/ exirq8 is selected
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 252 of 862 rej09b0429-0100 ? issr bit bit name initial value r/w description 7 iss7 0 r/w 0: p47/ irq7 is selected 1: p77/ exirq7 is selected 6 iss6 0 r/w 0: p46/ irq6 is selected 1: p76/ exirq6 is selected 5 iss5 0 r/w 0: p45/ irq5 is selected 1: p75/ exirq5 is selected 4 iss4 0 r/w 0: p44/ irq4 is selected 1: p74/ exirq4 is selected 3 iss3 0 r/w 0: p43/ irq3 is selected 1: p73/ exirq3 is selected 2 iss2 0 r/w 0: p42/ irq2 is selected 1: p72/ exirq2 is selected 1 iss1 0 r/w 0: p41/ irq1 is selected 1: p71/ exirq1 is selected 0 iss0 0 r/w 0: p40/ irq0 is selected 1: p70/ exirq0 is selected
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 253 of 862 rej09b0429-0100 8.16.2 port control register 0 (ptcnt0) ptcnt0 selects pins for the control mode for external extension. bit bit name initial value r/w description 7 scpfsel1 0 r/w controls the internal connection of txd1 and rxd1 with the sci_1 as the smart card interface. 0: txd1 and rxd1 are not internally connected. 1: txd1 and rxd1 are internally connected. 6 scpfsel3 0 r/w controls the internal connection of txd3 and rxd3 with the sci_3 as the smart card interface. 0: txd3 and rxd3 are not internally connected. 1: txd3 and rxd3 are internally connected. 5 to 2 ? all 0 r/w reserved the initial value should not be changed. 1 obe 0 r/w selects glueless extension. 0: control by rd , hwr , lwr 1: control by rd , wr , hbe , lbe (glueless extension) 0 ? 0 r/w reserved the initial value should not be changed.
section 8 i/o ports rev. 1.00 mar. 17, 2008 page 254 of 862 rej09b0429-0100
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 255 of 862 rej09b0429-0100 section 9 14-bit pwm timer (pwmx) this lsi has an on-chip 14-bit pulse-width modulator (pwm) timer with four output channels. it can be connected to an external low-pass filter to operate as a 14-bit d/a converter. 9.1 features ? division of pulse into multiple base cycles to reduce ripple ? eight resolution settings the resolution can be set to 1, 2, 64, 128, 256, 1024, 4096, or 16384 system clock cycles. ? two base cycle settings the base cycle can be set equal to t 64 or t 256, where t is the resolution. ? sixteen operation clocks (by combination of eight resolution settings and two base cycle settings) figure 9.1 shows a block diagram of the pwm (d/a) module. select clock bus interface clock internal data bus comparator a comparator b dadra dadrb pwx1 internal clock /2, /64, /128, /256, /1024, /4096, /16384 pwx0 fine?adjustment pulse addition a fine?adjustment pulse addition b [legend] dacr: dadra: dadrb: dacnt: pwmx d/a control register (6 bits) pwmx d/a data register a (15 bits) pwmx d/a data register b (15 bits) pwmx d/a counter (14 bits) dacnt dacr control logic base cycle compare match a base cycle compare match b base cycle overflow module data bus figure 9.1 pwmx (d/a) block diagram
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 256 of 862 rej09b0429-0100 9.2 input/output pins table 9.1 lists the pwmx (d/a) module input and output pins. table 9.1 pin configuration name abbreviation i/o function pwmx output pin 0 pwx0 output pwm timer pulse output of pwmx_0 channel a pwmx output pin 1 pwx1 output pwm timer pulse output of pwmx_0 channel b pwmx output pin 2 pwx2 output pwm timer pulse output of pwmx_1 channel a pwmx output pin 3 pwx3 output pwm timer pulse output of pwmx_1 channel b 9.3 register descriptions the pwmx (d/a) module has the following registers. for details on the module stop control register, see section 24.1.3, module stop control registers h, l, and a (mstpcrh, mstpcrl, mstpcra). ? pwmx (d/a) counter (dacnt) ? pwmx (d/a) data register a (dadra) ? pwmx (d/a) data register b (dadrb) ? pwmx (d/a) control register (dacr) ? peripheral clock select register (pcsr) note: the same addresses are shared by dadra and dacr, and by dadrb and dacnt. switching is performed by the regs bit in dacnt or dadrb.
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 257 of 862 rej09b0429-0100 9.3.1 pwmx (d/a) counter (dacnt) dacnt is a 14-bit readable/writa ble up-counter. the input clock is selected by the clock select bit (cks) in dacr. dacnt functions as the time base for both pwmx (d/a) channels. when a channel operates with 14-bit precision, it uses a ll dacnt bits. when a channel operates with 12- bit precision, it uses the lower 12 bits and ignores the upper two bits. dacnt cannot be accessed in 8-bit units. dacnt should always be accessed in 16-bit units. for details, see section 9.4, bus master interface. ? dacnt bit bit name initial value r/w description 15 to 8 uc7 to uc0 all 0 r/w lower up-counter 7 to 2 uc8 to uc13 all 0 r/w upper up-counter 1 ? 1 r reserved this bit is always read as 1 and cannot be modified. 0 regs 1 r/w register select dadra and dacr, and dadrb and dacnt, are located at the same addresses. the regs bit specifies which registers can be accessed. when changing the register to be accessed, set this bit in advance. 0: dadra and dadrb can be accessed 1: dacr and dacnt can be accessed
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 258 of 862 rej09b0429-0100 9.3.2 pwmx (d/a) data registers a and b (dadra and dadrb) dadra corresponds to pwmx (d/a) channel a, and dadrb to pwmx (d/a) channel b. the dadr registers cannot be accessed in 8-bit units. the dadr registers should always be accessed in 16-bit units. for details, see section 9.4, bus master interface. ? dadra bit bit name initial value r/w description 15 to 2 da13 to da0 all 1 r/w d/a data 13 to 0 these bits set a digital value to be converted to an analog value. in each base cycle, the dacnt value is continually compared with the dadr value to determine the duty cycle of the output waveform, and to decide whether to output a fine-adjustment pulse equal in width to the resolution. to enable this operation, this register must be set within a range that depends on the cfs bit. if the dadr value is outside this range, the pwm output is held constant. a channel can be operated with 12-bit precision by fixing da0 and da1 to 0. the two data bits are not compared with uc12 and uc13 of dacnt. 1 cfs 1 r/w carrier frequency select 0: base cycle = resolution (t) 64 the range of da13 to da0: h'0100 to h ' 3fff 1: base cycle = resolution (t) 256 the range of da13 to da0: h ' 0040 to h ' 3fff 0 ? 1 r reserved this bit is always read as 1 and cannot be modified.
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 259 of 862 rej09b0429-0100 ? dadrb bit bit name initial value r/w description 15 to 2 da13 to da0 all 1 r/w d/a data 13 to 0 these bits set a digital value to be converted to an analog value. in each base cycle, the dacnt value is continually compared with the dadr value to determine the duty cycle of the output waveform, and to decide whether to output a fine-adjustment pulse equal in width to the resolution. to enable this operation, this register must be set within a range that depends on the cfs bit. if the dadr value is outside this range, the pwm output is held constant. a channel can be operated with 12-bit precision by fixing da0 and da1 to 0. the two data bits are not compared with uc12 and uc13 of dacnt. 1 cfs 1 r/w carrier frequency select 0: base cycle = resolution (t) 64 da13 to da0 range = h ' 0100 to h ' 3fff 1: base cycle = resolution (t) 256 da13 to da0 range = h ' 0040 to h ' 3fff 0 regs 1 r/w register select dadra and dacr, and dadrb and dacnt, are located at the same addresses. the regs bit specifies which registers can be accessed. when changing the register to be accessed, set this bit in advance. 0: dadra and dadrb can be accessed 1: dacr and dacnt can be accessed
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 260 of 862 rej09b0429-0100 9.3.3 pwmx (d/a) control register (dacr) dacr enables the pwm outputs, and selects the output phase and operating speed. bit bit name initial value r/w description 7 ? 0 r/w reserved the initial value should not be changed. 6 pwme 0 r/w pwmx enable starts or stops the pwm d/a counter (dacnt). 0: dacnt operates as a 14-bit up-counter 1: dacnt halts at h'0003 5, 4 ? all 1 r reserved these bits are always read as 1 and cannot be modified. 3 oeb 0 r/w output enable b enables or disables output on pwmx (d/a) channel b. 0: pwmx (d/a) channel b output (at the pwx1, pwx3 pins) is disabled 1: pwmx (d/a) channel b output (at the pwx1, pwx3 pins) is enabled 2 oea 0 r/w output enable a enables or disables output on pwmx (d/a) channel a. 0: pwmx (d/a) channel a output (at the pwx0, pwx2 pin) is disabled 1: pwmx (d/a) channel a output (at the pwx0, pwx2 pins) is enabled 1 os 0 r/w output select selects the phase of the pwmx (d/a) output. 0: direct pwmx (d/a) output 1: inverted pwmx (d/a) output 0 cks 0 r/w clock select selects the pwmx (d/a) resolution. eight kinds of resolution can be selected. 0: operates at resolution (t) = system clock cycle time (t cyc ) 1: operates at resolution (t) = system clock cycle time (t cyc ) 2, 64, 128, 256, 1024, 4096, and 16384.
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 261 of 862 rej09b0429-0100 9.3.4 peripheral clock select register (pcsr) pcsr and the cks bit of dacr select the operating speed. bit bit name initial value r/w description 7 6 pwckx1b pwckx1a 0 0 r/w r/w pwmx_1 clock select these bits select a clock cycle with the cks bit of dacr of pwmx_1 being 1. see table 9.2. 5 4 pwckx0b pwckx0a 0 0 r/w r/w pwmx_0 clock select these bits select a clock cycle with the cks bit of dacr of pwmx_0 being 1. see table 9.2. 3 pwckx1c 0 r/w pwmx_1 clock select this bit selects a clock cycle with the cks bit of dacr of pwmx_1 being 1. see table 9.2. 2 1 ? ? 0 0 r/w r/w reserved the initial value should not be changed. 0 pwckx0c 0 r/w pwmx_0 clock select this bit selects a clock cycle with the cks bit of dacr of pwmx_0 being 1. see table 9.2. table 9.2 clock select of pwmx_1 and pwmx_0 pwckx0c pwckx1c pwckx0b pwckx1b pwckx0a pwckx1a resolution (t) 0 0 0 operates on the system clock cycle (t cyc ) x 2 0 0 1 operates on the system clock cycle (t cyc ) x 64 0 1 0 operates on the system clock cycle (t cyc ) x 128 0 1 1 operates on the system clock cycle (t cyc ) x 256 1 0 0 operates on the system clock cycle (t cyc ) x 1024 1 0 1 operates on the system clock cycle (t cyc ) x 4096 1 1 0 operates on the system clock cycle (t cyc ) x 16384 1 1 1 setting prohibited
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 262 of 862 rej09b0429-0100 9.4 bus master interface dacnt, dadra, and dadrb are 16-bit registers. the data bus linking the bus master and the on-chip peripheral modules, however, is only 8 bits wide. when the bus master accesses these registers, it therefore uses an 8-bit temporary register (temp). these registers are written to and read from as follows. ? write when the upper byte is written to, the upper-byte wr ite data is stored in temp. next, when the lower byte is written to, the lower-byte write data and temp value are combined, and the combined 16-bit value is written in the register. ? read when the upper byte is read from, the upper-byte value is transferred to the cpu and the lower-byte value is transferred to temp. next, when the lower byte is read from, the lower- byte value in temp is transferred to the cpu. these registers should always be accessed 16 bits at a time with a mov instruction, and the upper byte should always be accessed before the lower byte. correct data will not be transferred if only the upper byte or only the lower byte is accessed. also note that a bit ma nipulation instruction cannot be used to access these registers. example 1: write to dacnt mov.w r0, @dacnt ; write r0 contents to dacnt example 2: read dadra mov.w @dadra, r0 ; copy contents of dadra to r0
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 263 of 862 rej09b0429-0100 9.5 operation a pwm waveform like the one shown in figure 9.2 is output from the pwx pin. da13 to da0 in dadr corresponds to the total width (t l ) of the low (0) pulses output in one conversion cycle (256 pulses when cfs = 0, 64 pulses when cfs = 1). when os = 0, this waveform is directly output. when os = 1, the output waveform is inverted, and da13 to da0 in dadr value corresponds to the total width (t h ) of the high (1) output pulses. figures 9.3 and 9.4 show the types of waveform output available. t f t l t: resolution t l = t ln (os = 0) (when cfs = 0, m = 256 when cfs = 1, m = 64) m n = 1 1 conversion cycle (t 2 14 (= 16384)) base cycle (t 64 or t 256) figure 9.2 pwmx (d/a) operation table 9.3 summarizes the relationships between the cks and cfs bit settings and the resolution, base cycle, and conversion cycle. the pwm out put remains fixed unless da13 to da0 in dadr contain at least a certain mini mum value. the relationship between the os bit and the output waveform is shown in figures 9.3 and 9.4.
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 264 of 862 rej09b0429-0100 table 9.3 settings and operation (examples when = 34 mhz) pcsr fixed dadr bits pwckx0 pwckx1 bit data c b a cks reso- lution t ( s) cfs base cycle conver- sion cycle tl/th (os = 0/os = 1) precision (bits) da3 da2 da1 da0 conversion cycle * ? ? ? 0 0 1.88 s 481.88 s 14 481.88 s 531.3 khz 12 0 0 120.47 s always low/high output da13 to 0 = h'0000 to h'00ff (data value) t da13 to 0 = h'0100 to h'3fff 10 0 0 0 0 30.12 s 1 7.53 s 481.88 s 14 481.88 s 0.03 ( ) 132.8 khz 12 0 0 120.47 s always low/high output da13 to 0 = h'0000 to h'003f (data value) t da13 to 0 = h'0040 to h'3fff 10 0 0 0 0 30.12 s 0 0 0 1 0 3.76 s 0.964 ms 14 0.964 ms 265.6 khz 12 0 0 0.241 ms always low/high output da13 to 0 = h'0000 to h'00ff (data value) t da13 to 0 = h'0100 to h'3fff 10 0 0 0 0 0.060 ms 1 15.06 s 0.964 ms 14 0.964 ms 66.4 khz 12 0 0 0.241 ms 0.06 ( /2) always low/high output da13 to 0 = h'0000 to h'003f (data value) t da13 to 0 = h'0040 to h'3fff 10 0 0 0 0 0.060 ms 0 0 1 1 0 120.5 s 30.840 ms 14 30.840 ms 8.3 khz 12 0 0 7.710 ms always low/high output da13 to 0 = h'0000 to h'00ff (data value) t da13 to 0 = h'0100 to h'3fff 10 0 0 0 0 1.928 ms 1 481.9 s 30.840 ms 14 30.840 ms 2.1 khz 12 0 0 7.710 ms 1.88 ( /64) always low/high output da13 to 0 = h'0000 to h'003f (data value) t da13 to 0 = h'0040 to h'3fff 10 0 0 0 0 1.928 ms 0 1 0 1 0 240.9 s 61.681 ms 14 61.681 ms 4.2 khz 12 0 0 15.420 ms always low/high output da13 to 0 = h'0000 to h'00ff (data value) t da13 to 0 = h'0100 to h'3fff 10 0 0 0 0 3.855 ms 1 963.8 s 61.681 ms 14 61.681 ms 1.0 khz 12 0 0 15.420 ms 3.76 ( /128) always low/high output da13 to 0 = h'0000 to h'003f (data value) t da13 to 0 = h'0040 to h'3fff 10 0 0 0 0 3.855 ms
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 265 of 862 rej09b0429-0100 pcsr fixed dadr bits pwckx0 pwckx1 bit data c b a cks reso- lution t ( s) cfs base cycle conver- sion cycle tl/th (os = 0/os = 1) precision (bits) da3 da2 da1 da0 conversion cycle * 0 1 1 1 0 481.9 s 123.36 ms 14 123.36 ms 2.1 khz 12 0 0 30.84 ms always low/high output da13 to 0 = h'0000 to h'00ff (data value) t da13 to 0 = h'0100 to h'3fff 10 0 0 0 0 7.71 ms 1 1927.5 s 123.36 ms 14 123.36 ms 0.5 khz 12 0 0 30.84 ms 7.53 ( /256) always low/high output da13 to 0 = h'0000 to h'003f (data value) t da13 to 0 = h'0040 to h'3fff 10 0 0 0 0 7.71 ms 1 0 0 1 0 1.93 ms 493.45 ms 14 493.45 ms 518.8 hz 12 0 0 123.36 ms always low/high output da13 to 0 = h'0000 to h'00ff (data value) t da13 to 0 = h'0100 to h'3fff 10 0 0 0 0 30.84 ms 1 7.71 ms 493.45 ms 14 493.45 ms 129.7 hz 12 0 0 123.36 ms 30.12 ( /1024) always low/high output da13 to 0 = h'0000 to h'003f (data value) t da13 to 0 = h'0040 to h'3fff 10 0 0 0 0 30.84 ms 1 0 1 1 0 7.71 ms 1.974 s 14 1.974 s 129.7 hz 12 0 0 0.493 s always low/high output da13 to 0 = h'0000 to h'00ff (data value) t da13 to 0 = h'0100 to h'3fff 10 0 0 0 0 0.123 s 1 30.84 ms 1.974 s 14 1.974 s 32.4 hz 12 0 0 0.493 s 120.47 ( /4096) always low/high output da13 to 0 = h'0000 to h'003f (data value) t da13 to 0 = h'0040 to h'3fff 10 0 0 0 0 0.123 s 1 1 0 1 0 30.84 ms 7.895 s 14 7.895 s 32.4 hz 12 0 0 1.974 s always low/high output da13 to 0 = h'0000 to h'00ff (data value) t da13 to 0 = h'0100 to h'3fff 10 0 0 0 0 0.493 s 1 123.36 ms 7.895 s 14 7.895 s 8.1 hz 12 0 0 1.974 s 481.88 ( /16384) always low/high output da13 to 0 = h'0000 to h'003f (data value) t da13 to 0 = h'0040 to h'3fff 10 0 0 0 0 0.493 s 1 1 1 1 setting prohibited ? ? ? ? ? ? ? ? ? ? note: * indicates the conversion cycle when specific da3 to da0 bits are fixed.
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 266 of 862 rej09b0429-0100 t f1 t f2 t f255 t f256 t l1 t l2 t l3 t l255 t l256 1 conversion cycle t f1 = t f2 = t f3 = = t f255 = t f256 = t 64 t l1 + t l2 + t l3 + + t l255 + t l256 = t l t f1 t f2 t f63 t f64 t l1 t l2 t l3 t l63 t l64 1 conversion cycle t f1 = t f2 = t f3 = = t f63 = t f64 = t 256 t l1 + t l2 + t l3 + + t l63 + t l64 = t l a. cfs = 0 [base cycle = resolution (t) 64] b. cfs = 1 [base cycle = resolution (t) 256] figure 9.3 output waveform (os = 0, dadr corresponds to t l )
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 267 of 862 rej09b0429-0100 t f1 t f2 t f255 t f256 t h1 t h2 t h3 t h255 t h256 1 conversion cycle t f1 = t f2 = t f3 = = t f255 = t f256 = t 64 t h1 + t h2 + t h3 + + t h255 + t h256 = t h t f1 t f2 t f63 t f64 t h1 t h2 t h3 t h63 t h64 1 conversion cycle t f1 = t f2 = t f3 = = t f63 = t f64 = t 256 t h1 + t h2 + t h3 + + t h63 + t h64 = t h a. cfs = 0 [base cycle = resolution (t) 64] b. cfs = 1 [base cycle = resolution (t) 256] figure 9.4 output waveform (os = 1, dadr corresponds to t h ) an example of the additional pulses when cfs = 1 (base cycle = resolution (t) 256) and os = 1 (inverted pwm output) is described below. when cfs = 1, the upper eight bits (da13 to da6) in dadr determine the duty cycle of the base pulse while the subsequent six bits (da5 to da0) determine the locations of the additional pulses as shown in figure 9.5. table 9.4 lists the locations of the additional pulses. da13 da12 da11 da10 da9 da8 da7 da6 da5 da4 da3 da2 da1 da0 cfs 11 duty cycle of base pulse location of additional pulses figure 9.5 d/a data register configuration when cfs = 1 in this example, dadr = h'0207 (b'0000 0010 0000 0111). the output waveform is shown in figure 9.6. since cfs = 1 and the value of the upper eight bits is b'0000 0010, the high width of the base pulse duty cycle is 2/256 (t).
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 268 of 862 rej09b0429-0100 since the value of the subsequent six bits is b'0000 01, an additional pulse is output only at the location of base pulse no. 63 according to table 9.4. thus, an additional pulse of 1/256 (t) is to be added to the base pulse. 1 conversion cycle base pulse high width: 2/256 (t) base pulse 2/256 (t) additional pulse 1/256 (t) base cycle base cycle base cycle no. 1 no. 0 no. 63 additional pulse output location figure 9.6 output waveform when dadr = h'0207 (os = 1) however, when cfs = 0 (base cycle = resolution (t) 64), the duty cycle of the base pulse is determined by the upper six bits and the locations of the additional pulses by the subsequent eight bits with a method similar to as above.
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 269 of 862 rej09b0429-0100 table 9.4 locations of additional pulses added to base pulse (when cfs = 1) lower 6 bits base pulse no. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 1 2 3 4 5 6 7 8 9 1011121314 151617 181920212223 24252627 282930313233 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
section 9 14-bit pwm timer (pwmx) rev. 1.00 mar. 17, 2008 page 270 of 862 rej09b0429-0100
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 271 of 862 rej09b0429-0100 section 10 16-bit free-running timer (frt) this lsi has a 16-bit free-running timer (frt). 10.1 features ? selection of three clock sources ? one of the three internal clocks ( /2, /8, or /32) can be selected. ? two independent comparators ? counter clearing ? the free-running counters can be cleared on compare-match a. ? three independent interrupts ? two compare-match interrupts and one overflow interrupt can be requested independently. ? special functions provided by automatic addition function ? the contents of ocrar and ocraf can be added to the contents of ocra automatically, enabling a periodic waveform to be generated without software intervention.
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 272 of 862 rej09b0429-0100 figure 10.1 is a block diagram of the frt. clock selector clock compare-match a ocra comparator a internal data bus frc comparator b control logic ocrb tcsr internal clock /2 /8 /32 compare-match b overflow clear tier tcr tocr interrupt signal [legend] ocra, ocrb: ocrar,ocraf: frc: tcsr: tier: tcr: tocr: output compare registers a and b (16 bits) output compare registers ar and af (16 bits) free-running counter (16 bits) timer control/status register (8 bits) timer interrupt enable register (8 bits) timer control register (8 bits) timer output compare control register (8 bits) ocia ocib fovi ocrar/f module data bus bus interface figure 10.1 block diagram of 16-bit free-running timer
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 273 of 862 rej09b0429-0100 10.2 register descriptions the frt has the following registers. ? free-running counter (frc) ? output compare register a (ocra) ? output compare register b (ocrb) ? output compare register ar (ocrar) ? output compare regi ster af (ocraf) ? timer interrupt enable register (tier) ? timer control/status register (tcsr) ? timer control register (tcr) ? timer output compare control register (tocr) note: ocra and ocrb share the same address. register selection is controlled by the ocrs bit in tocr. 10.2.1 free-running counter (frc) frc is a 16-bit readable/writable up-counter. the clock source is selected by bits cks1 and cks0 in tcr. frc can be cleared by compare-match a. when frc overflows from h'ffff to h'0000, the overflow flag bit (ovf) in tcsr is set to 1. frc should always be accessed in 16-bit units; cannot be accessed in 8-bit un its. frc is initia lized to h'0000. 10.2.2 output compare registers a and b (ocra and ocrb) the frt has two output compare registers, ocra and ocrb, each of which is a 16-bit readable/writable register whose contents are continually compared with the value in frc. when a match is detected (compare-match), the corresponding output compare flag (ocfa or ocfb) is set to 1 in tcsr. ocr should always be accesse d in 16-bit units; cannot be accessed in 8-bit units. ocr is initialized to h'ffff.
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 274 of 862 rej09b0429-0100 10.2.3 output compare regist ers ar and af (ocrar and ocraf) ocrar and ocraf are 16-bit readable/writable registers. they are accessed when the icrs bit in tocr is set to 1. when the ocrams bit in tocr is set to 1, the operation of ocra is changed to include the use of ocrar and ocraf. the contents of ocrar and ocraf are automatically added alternately to ocra, and the result is written to ocra. the write operation is performed on the occurrence of compare-match a. in the 1st compare-match a after setting the ocrams bit to 1, ocraf is added. the opera tion due to compare-match a varies according to whether the compare-match follows addition of ocrar or ocraf. when using the ocra automatic addition function, do not select internal clock /2 as the frc input clock together with a set value of h'0001 or less for ocrar (or ocraf). ocrar and ocraf should always be accessed in 16-bit units; cannot be accessed in 8-bit units. ocrar and ocraf are initialized to h'ffff.
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 275 of 862 rej09b0429-0100 10.2.4 timer interrupt enable register (tier) tier enables and disables interrupt requests. bit bit name initial value r/w description 7 to 4 ? all 0 r reserved these bits are always read as 0 and cannot be modified. 3 ociae 0 r/w output compare interrupt a enable selects whether to enable output compare interrupt a request (ocia) when output compare flag a (ocfa) in tcsr is set to 1. 0: ocia requested by ocfa is disabled 1: ocia requested by ocfa is enabled 2 ocibe 0 r/w output compare interrupt b enable selects whether to enable output compare interrupt b request (ocib) when output compare flag b (ocfb) in tcsr is set to 1. 0: ocib requested by ocfb is disabled 1: ocib requested by ocfb is enabled 1 ovie 0 r/w timer overflow interrupt enable selects whether to enable a free-running timer overflow request interrupt (fovi) when the timer overflow flag (ovf) in tcsr is set to 1. 0: fovi requested by ovf is disabled 1: fovi requested by ovf is enabled 0 ? 0 r reserved this bit is always read as 0 and cannot be modified.
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 276 of 862 rej09b0429-0100 10.2.5 timer control/sta tus register (tcsr) tcsr is used for counter clear selection and control of interrupt request signals. bit bit name initial value r/w description 7 to 4 ? all 0 r reserved these bits are always read as 0 and cannot be modified. 3 ocfa 0 r/(w) * output compare flag a indicates that the frc value matches the ocra value. [setting condition] when frc = ocra [clearing condition] read ocfa when ocfa = 1, then write 0 to ocfa 2 ocfb 0 r/(w) * output compare flag b indicates that the frc value matches the ocrb value. [setting condition] when frc = ocrb [clearing condition] read ocfb when ocfb = 1, then write 0 to ocfb 1 ovf 0 r/(w) * overflow flag indicates that the frc has overflowed. [setting condition] when frc overflows (changes from h'ffff to h'0000) [clearing condition] read ovf when ovf = 1, then write 0 to ovf 0 cclra 0 r/w counter clear a selects whether the frc is to be cleared on compare- match a (when the frc and ocra values match). 0: frc clearing is disabled 1: frc is cleared on compare-match a note: * only 0 can be written to clear the flag.
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 277 of 862 rej09b0429-0100 10.2.6 timer control register (tcr) tcr selects the rising or falling edge of the input capture signals, enables the input capture buffer mode, and selects the frc clock source. bit bit name initial value r/w description 7 to 2 ? all 0 r reserved these bits are always read as 0 and cannot be modified. 1 0 cks1 cks0 0 0 r/w r/w clock select 1 and 0 select clock source for frc. 00: /2 internal clock source 01: /8 internal clock source 10: /32 internal clock source 11: reserved
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 278 of 862 rej09b0429-0100 10.2.7 timer output compa re control register (tocr) tocr enables output from the output compare pins, selects th e output levels, switches access between output compare registers a and b, and controls the ocra operating modes. bit bit name initial value r/w description 7 ? 0 r reserved this bit is always read as 0 and cannot be modified. 6 ocrams 0 r/w output compare a mode select specifies whether ocra is used in the normal operating mode or in the operating mode using ocrar and ocraf. 0: the normal operating mode is specified for ocra 1: the operating mode using ocrar and ocraf is specified for ocra 5 ? 0 r reserved this bit is always read as 0 and cannot be modified. 4 ocrs 0 r/w output compare register select ocra and ocrb share the same address. when this address is accessed, the ocrs bit selects which register is accessed. the operation of ocra or ocrb is not affected. 0: ocra is selected 1: ocrb is selected 3 to 0 ? all 0 r reserved these bits are always read as 0 and cannot be modified.
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 279 of 862 rej09b0429-0100 10.3 operation timing 10.3.1 frc increment timing figure 10.2 shows the frc increment timing with an internal clock source. internal clock frc input clock frc n ? 1 n + 1 n figure 10.2 increment timing with internal clock source 10.3.2 output compare output timing a compare-match signal occurs at the last stat e when the frc and ocr values match (at the timing when the frc updates the counter value). when a compare-match signal occurs, the level selected by the olvl bit in tocr is output at the output compare pin (ftoa or ftob). figure 10.3 shows the timing of this operation for compare-match a. frc ocra nn n+1 n+1 nn compare-match a signal figure 10.3 timing of output compare a output
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 280 of 862 rej09b0429-0100 10.3.3 frc clear timing frc can be cleared when comp are-match a occurs. figure 10.4 shows the timing of this operation. frc n h'0000 compare-match a signal figure 10.4 clearing of frc by compare-match a signal 10.3.4 timing of output compare flag (ocf) setting the output compare flag, ocfa or ocfb, is set to 1 by a compare-match signal generated when the frc value matches the ocra or ocrb value. th is compare-match signal is generated at the last state in which the two values match, just before frc increments to a new value. when the frc and ocra or ocrb value match, the compare-match signal is not generated until the next cycle of the clock source. figure 10.5 shows the timing of setting the ocfa or ocfb flag. compare-match signal ocfa, ocfb ocra, ocrb n frc n n + 1 figure 10.5 timing of output compare flag (ocfa or ocfb) setting
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 281 of 862 rej09b0429-0100 10.3.5 timing of frc overflow flag (ovf) setting the frc overflow flag (ovf) is set to 1 wh en frc overflows (change s from h'ffff to h'0000). figure 10.6 shows the timing of setting the ovf flag. overflow signal frc h'ffff h'0000 ovf figure 10.6 timing of overflow flag (ovf) setting
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 282 of 862 rej09b0429-0100 10.3.6 automatic addition timing when the ocrams bit in tocr is set to 1, the contents of ocrar and ocraf are automatically added to ocra alternately, and wh en an ocra compare-ma tch occurs, a write to ocra is performed. figure 10.7 shows the ocra write timing. compare-match signal ocrar, ocraf a ocra n n + a frc n n +1 figure 10.7 ocra automatic addition timing 10.4 interrupt sources the free-running timer can request three interrupt s: ocia, ocib, and fovi. each interrupt can be enabled or disabled by an enable bit in tier. independent signals are sent to the interrupt controller for each interrupt. table 10.1 lists th e sources and priorities of these interrupts. the ocia and ocib interrupts can be used as the on-chip dtc activation sources. table 10.1 frt interrupt sources interrupt interrupt source interr upt flag dtc activation priority ocia compare match of ocra ocfa possible high ocib compare match of ocrb ocfb possible fovi overflow of frc ovf not possible low
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 283 of 862 rej09b0429-0100 10.5 usage notes 10.5.1 conflict between frc write and clear if an internal counter clear signal is generated du ring the state after an fr c write cycle, the clear signal takes priority and the write is not performed. figure 10.8 shows the timing for this type of conflict. address frc address internal write signal counter clear signal frc n h'0000 t 1 t 2 write cycle of frc figure 10.8 conflict between frc write and clear
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 284 of 862 rej09b0429-0100 10.5.2 conflict between frc write and increment if an frc increment pulse is generated during the state after an frc write cycle, the write takes priority and frc is not incremented. figure 10.9 shows the timing for this type of conflict. address frc address internal write signal frc input clock write data frc n m t 1 t 2 write cycle of frc figure 10.9 conflict between frc write and increment
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 285 of 862 rej09b0429-0100 10.5.3 conflict between ocr write and compare-match if a compare-match occurs during the state after an ocra or ocrb write cycle, the write takes priority and the compare-match signal is disabled. figure 10.10 shows the timing for this type of conflict. if automatic addition of ocrar and ocraf to oc ra is selected, and a compare-match occurs in the cycle following the ocra, ocrar, a nd ocraf write cycle, the ocra, ocrar and ocraf write takes priority and the compare-match signal is disabled. consequently, the result of the automatic addition is not written to ocra. figure 10.11 shows the timing of this type of conflict. address ocr address internal write signal compare-match signal frc write data disabled ocr n m n n + 1 t 1 t 2 write cycle of ocr figure 10.10 conflict between ocr write and compare-match (when automatic addition function is not used)
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 286 of 862 rej09b0429-0100 address ocrar (ocraf) address internal write signal compare-match signal frc automatic addition is not performed because compare-match signals are disabled. disabled ocr n n n+1 ocrar (ocraf) old data new data figure 10.11 conflict between ocr write and compare-match (when automatic addition function is used) 10.5.4 switching of internal clock and frc operation when the internal clock is cha nged, the changeover may source frc to increment. this depends on the time at which the clock is switched (bits cks1 and cks0 are rewritten), as shown in table 10.2. when an internal clock is used, the frc clock is generated on detection of the falling edge of the internal clock scaled from the system clock ( ). if the clock is changed when the old source is high and the new source is low, as in case no. 3 in ta ble 10.2, the changeover is regarded as a falling edge that triggers the frc clock, and frc is incremented. switching between an internal clock and external clock can also source frc to increment.
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 287 of 862 rej09b0429-0100 table 10.2 switching of internal clock and frc operation no. timing of switchover by means of cks1 and cks0 bits frc operation 1 switching from low to low clock before switchover clock after switchover frc clock frc cks bit rewrite n n + 1 2 switching from low to high clock before switchover clock after switchover frc clock frc n n + 1 n + 2 cks bit rewrite 3 switching from high to low clock before switchover clock after switchover frc clock frc cks bit rewrite n n + 2 n + 1 *
section 10 16-bit free-running timer (frt) rev. 1.00 mar. 17, 2008 page 288 of 862 rej09b0429-0100 no. timing of switchover by means of cks1 and cks0 bits frc operation 4 switching from high to high clock before switchover clock after switchover frc clock frc n n + 1 cks bit rewrite n + 2 note: * generated because the switchover is assumed to take place on a falling edge, and frc is incremented.
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 289 of 862 rej09b0429-0100 section 11 8-bit timer (tmr) this lsi has two channels of 8-bit timer modules (tmr_0 and tmr_1) which operate on the 8- bit counter. this lsi also has two channels of similar 8-bit timer modules (tmr_y and tmr_x). 11.1 features ? selection of clock sources ? tmr_0, tmr_1: the counter input clock can be selected from six internal clocks. ? tmr_y, tmr_x: the counter input clock can be selected from three internal clocks. ? selection of two ways to clear the counters ? the counters can be cleared on compare-match a and compare-match b. ? cascading of tmr_0 and tmr_1 (cascading of tmr_y and tmr_x is not allowed) ? operation as a 16-bit timer can be performed using tmr_0 as the upper half and tmr_1 as the lower half (16-bit count mode). tmr_1 can be used to count tmr_0 compare match occurrences (compare-match count mode). ? multiple interrupt sources for each channel ? tmr_0, tmr_1, tmr_y and tmr_x: three interrupts: compare-match a, compare-match b, and overflow
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 290 of 862 rej09b0429-0100 figures 11.1 and 11.2 are block diagrams of 8-bit timers. internal clock tmr_0 /2, /8, /32, /64, /256, /1024 clock 1 clock 0 compare match a1 compare match a0 clear 1 cmia0 cmib0 ovi0 cmia1 cmib1 ovi1 tcora_0 comparator a_0 comparator b_0 tcorb_0 tcsr_0 tcr_0 tcora_1 comparator a_1 tcnt_1 comparator b_1 tcorb_1 tcsr_1 tcr_1 tcnt_0 overflow 1 overflow 0 compare match b1 compare match b0 select clock control logic internal bus [legend] interrupt signals clear 0 tmr_1 /2, /8, /64, /128, /1024, /2048 tcora_0: tcorb_0: tcnt_0: tcsr_0: tcr_0: tcora_1: tcorb_1: tcnt_1: tcsr_1: tcr_1: time constant register a_0 time constant register b_0 timer counter_0 timer control/status register_0 timer control register_0 time constant register a_1 time constant register b_1 timer counter_1 timer control/status register_1 timer control register_1 figure 11.1 block diagram of 8-bit timer (tmr_0 and tmr_1)
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 291 of 862 rej09b0429-0100 internal clock clock x clock y compare match ax compare match ay clear x tcora_y comparator a_y comparator b_y tcor_y tcr_y tcora1_x comparator a_x tcnt_x comparator b_x tcorb_y tcorb_x tcsr_x tcr_x tcnt_y overflow x overflow y compare match bx compare match by select clock control logic internal bus [legend] interrupt signals clear y tmr_x , /2, /4 tmr_y /4, /256, /2048 cmiax cmibx ovix cmiay cmiby oviy tcora_y: tcorb_y: tcnt_y: tcsr_y: tcr_y: tcora_x: tcorb_x: tcnt_x: tcsr_x: tcr_x: tcorc: time constant register a_y time constant register b_y timer counter_y timer control / status register_y timer control register_y time constant register a_x time constant register b_x timer counter_x timer control / status register_x timer control register_x tme constant registerc figure 11.2 block diagram of 8-bit timer (tmr_y and tmr_x)
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 292 of 862 rej09b0429-0100 11.2 register descriptions the tmr has the following regist ers for each channel. for details on the serial timer control register, see section 3.2.3, serial timer control register (stcr). ? timer counter (tcnt) ? time constant register a (tcora) ? time constant register b (tcorb) ? timer control register (tcr) ? timer control/status register (tcsr) ? timer connection register s (tconrs)* notes: some of the registers of tmr_x and tmr_y use the same address. the registers can be switched by the tmrx/y bit in tconrs. * tconrs is only provided for tmr_x 11.2.1 timer counter (tcnt) each tcnt is an 8-bit readable/writable up-co unter. tcnt_0 and tcnt_1 comprise a single 16- bit register, so they can be accessed together by word access. the clock source is selected by the cks2 to cks0 bits in tcr. tcnt can be cleared by a compare-match a signal or compare- match b signal. the method of clearing can be se lected by the cclr1 and cclr0 bits in tcr. when tcnt overflows (changes from h'ff to h'00), the ovf bit in tcsr is set to 1. tcnt is initialized to h'00. tcnt_y can be accessed when the tmrx/y b it in tconrs is 1. tcnt_x can be accessed when the tmrx/y bit in tconrs is 0. see section 11.2.6, timer connection register s (tconrs).
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 293 of 862 rej09b0429-0100 11.2.2 time constant register a (tcora) tcora is an 8-bit readable/writable register. tcora_0 and tcora_1 comprise a single 16-bit register, so they can be accessed together by wo rd access. tcora is con tinually compared with the value in tcnt. when a match is detected, the corresponding compare-match flag a (cmfa) in tcsr is set to 1. however, comparison is disa bled during the t2 state of a tcora write cycle. tcora is initialized to h'ff. tcora_y can be accessed when the tmrx/y b it in tconrs is 1. tcora_x can be accessed when the tmrx/y bit in tconrs is 0. see section 11.2.6, timer connection register s (tconrs). 11.2.3 time constant register b (tcorb) tcorb is an 8-bit readable/writable register. tcorb_0 and tcorb_ 1 comprise a single 16-bit register, so they can be accessed together by wo rd access. tcorb is con tinually compared with the value in tcnt. when a match is detected, the corresponding compare-match flag b (cmfb) in tcsr is set to 1. however, comparison is disa bled during the t2 state of a tcorb write cycle. tcorb is initialized to h'ff. tcorb_y can be accessed when the tmrx/y bit in tconrs is 1. tcorb_x can be accessed when the tmrx/y bit in tconrs is 0. see section 11.2.6, timer connection register s (tconrs).
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 294 of 862 rej09b0429-0100 11.2.4 timer control register (tcr) tcr selects the tcnt clock source and the condition by which tcnt is cleared, and enables/disables interrupt requests. tcr_y can be accessed when the tmrx/y bit in tconrs is 1. tcr_x can be accessed when the tmrx/y bit in tconrs is 0. see section 11.2.6, timer connection register s (tconrs). bit bit name initial value r/w description 7 cmieb 0 r/w compare-match interrupt enable b selects whether the cmfb interrupt request (cmib) is enabled or disabled when the cmfb flag in tcsr is set to 1. 0: cmfb interrupt request (cmib) is disabled 1: cmfb interrupt request (cmib) is enabled 6 cmiea 0 r/w compare-match interrupt enable a selects whether the cmfa interrupt request (cmia) is enabled or disabled when the cmfa flag in tcsr is set to 1. 0: cmfa interrupt request (cmia) is disabled 1: cmfa interrupt request (cmia) is enabled 5 ovie 0 r/w timer overflow interrupt enable selects whether the ovf interrupt request (ovi) is enabled or disabled when the ovf flag in tcsr is set to 1. 0: ovf interrupt request (ovi) is disabled 1: ovf interrupt request (ovi) is enabled 4 3 cclr1 cclr0 0 0 r/w r/w counter clear 1 and 0 specify the clearing conditions of tcnt. 00: counter clear is disabled 01: counter clear is enabled on compare-match a 10: counter clear is enabled on compare-match b 11: setting prohibited 2 to 0 cks2 to cks0 all 0 r/w clock select 2 to 0 select the clock input to tcnt and count condition, together with the icks1 and icks0 bits in stcr. for details, see table 11.1.
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 295 of 862 rej09b0429-0100 table 11.1 (1) clock input to tcnt and count condition (tmr_0) tcr stcr cks2 cks1 cks0 icks0 description 0 0 0 x disables clock input 0 0 1 0 increments at falling edge of internal clock /8 0 0 1 1 increments at falling edge of internal clock /2 0 1 0 0 increments at falling edge of internal clock /64 0 1 0 1 increments at falling edge of internal clock /32 0 1 1 0 increments at falling edge of internal clock /1024 0 1 1 1 increments at falling edge of internal clock /256 1 0 0 x increments at overflow signal from tcnt_1 * 1 0 1 x setting prohibited 1 1 x x setting prohibited note: * if the tmr_0 clock input is set as the tcnt_1 overflow signal and the tmr_1 clock input is set as the tcnt_0 compare-match signal simultaneously, a count-up clock cannot be generated. simultaneous setting of these conditions should be avoided. [legend] x: don't care
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 296 of 862 rej09b0429-0100 table 11.1 (2) clock input to tcnt and count condition (tmr_1) tcr stcr cks2 cks1 cks0 icks1 description 0 0 0 x disables clock input 0 0 1 0 increments at falling edge of internal clock /8 0 0 1 1 increments at falling edge of internal clock /2 0 1 0 0 increments at falling edge of internal clock /64 0 1 0 1 increments at falling edge of internal clock /128 0 1 1 0 increments at falling edge of internal clock /1024 0 1 1 1 increments at falling edge of internal clock /2048 1 0 0 x increments at compare-match a from tcnt_0 * 1 0 1 x setting prohibited 1 1 x x setting prohibited note: * if the tmr_0 clock input is set as the tcnt_1 overflow signal and the tmr_1 clock input is set as the tcnt_0 compare-match signal simultaneously, a count-up clock cannot be generated. simultaneous setting of these conditions should be avoided. [legend] x: don't care table 11.1 (3) clock input to tcnt and count condition (tmr_x, tmr_y) tcr channel cks2 cks1 cks0 description 0 0 0 disables clock input 0 0 1 increments at falling edge of internal clock /4 0 1 0 increments at falling edge of internal clock /256 0 1 1 increments at falling edge of internal clock /2048 tmr_y 1 x x setting prohibited 0 0 0 disables clock input 0 0 1 increments at falling edge of internal clock 0 1 0 increments at falling edge of internal clock /2 0 1 1 increments at falling edge of internal clock /4 tmr_y 1 x x setting prohibited [legend] x: don't care
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 297 of 862 rej09b0429-0100 11.2.5 timer control/sta tus register (tcsr) tcsr indicates the status flags and controls compare-match output. see section 11.2.6, timer connection register s (tconrs) for details on the tcsr_y and tcsr_x accesses. ? tcsr_0 bit bit name initial value r/w description 7 cmfb 0 r/(w) * compare-match flag b [setting condition] when the values of tcnt_0 and tcorb_0 match [clearing condition] read cmfb when cmfb = 1, then write 0 in cmfb 6 cmfa 0 r/(w) * compare-match flag a [setting condition] when the values of tcnt_0 and tcora_0 match [clearing condition] read cmfa when cmfa = 1, then write 0 in cmfa 5 ovf 0 r/(w) * timer overflow flag [setting condition] when tcnt_0 overflows from h ff to h 00 [clearing condition] read ovf when ovf = 1, then write 0 in ovf 4 adte 0 r/w a/d trigger enable selects whether the a/d conversion start request on compare match a is enabled or disabled. 0: a/d conversion start request is disabled 1: a/d conversion start request is enabled 3 to 0 ? all 1 r reserved these bits are always read as 1 and cannot be modified. note: * only 0 can be written to clear the flag.
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 298 of 862 rej09b0429-0100 ? tcsr_1 bit bit name initial value r/w description 7 cmfb 0 r/(w) * compare-match flag b [setting condition] when the values of tcnt_1 and tcorb_1 match [clearing condition] read cmfb when cmfb = 1, then write 0 in cmfb 6 cmfa 0 r/(w) * compare-match flag a [setting condition] when the values of tcnt_1 and tcora_1 match [clearing condition] read cmfa when cmfa = 1, then write 0 in cmfa 5 ovf 0 r/(w) * timer overflow flag [setting condition] when tcnt_1 overflows from h ff to h 00 [clearing condition] read ovf when ovf = 1, then write 0 in ovf 4 to 0 ? all 1 r reserved these bits are always read as 1 and cannot be modified. note: * only 0 can be written to clear the flag.
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 299 of 862 rej09b0429-0100 ? tcsr_y this register can be accessed when the tmrx/y bit in tconrs is 1. bit bit name initial value r/w description 7 cmfb 0 r/(w) * compare-match flag b [setting condition] when the values of tcnt_y and tcorb_y match [clearing condition] read cmfb when cmfb = 1, then write 0 in cmfb 6 cmfa 0 r/(w) * compare-match flag a [setting condition] when the values of tcnt_y and tcora_y match [clearing condition] read cmfa when cmfa = 1, then write 0 in cmfa 5 ovf 0 r/(w) * timer overflow flag [setting condition] when tcnt_y overflows from h'ff to h'00 [clearing condition] read ovf when ovf = 1, then write 0 in ovf 4 to 0 ? all 1 r reserved these bits are always read as 1 and cannot be modified. note: * only 0 can be written to clear the flag.
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 300 of 862 rej09b0429-0100 ? tcsr_x this register can be accessed when the tmrx/y bit in tconrs is 0. bit bit name initial value r/w description 7 cmfb 0 r/(w) * compare-match flag b [setting condition] when the values of tcnt_x and tcorb_x match [clearing condition] read cmfb when cmfb = 1, then write 0 in cmfb 6 cmfa 0 r/(w) * compare-match flag a [setting condition] when the values of tcnt_x and tcora_x match [clearing condition] read cmfa when cmfa = 1, then write 0 in cmfa 5 ovf 0 r/(w) * timer overflow flag [setting condition] when tcnt_x overflows from h'ff to h'00 [clearing condition] read ovf when ovf = 1, then write 0 in ovf 4 to 0 ? all 1 r reserved these bits are always read as 1 and cannot be modified. note: * only 0 can be written to clear the flag.
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 301 of 862 rej09b0429-0100 11.2.6 timer connection register s (tconrs) tconrs selects whether to access tmr_x or tmr_y registers. bit bit name initial value r/w description 7 tmrx/y 0 r/w tmr_x/tmr_y access select for details, see table 11.2. 0: the tmr_x registers are accessed at addresses h'fffff0 to h'fffff5 1: the tmr_y registers are accessed at addresses h'fffff0 to h'fffff5 6 to 0 ? all 0 r/w reserved the initial values should not be changed. table 11.2 registers accessible by tmr_x/tmr_y tmrx/y h'fffff0 h'fffff1 h'fffff2 h' fffff3 h'fffff4 h'fffff5 h'fffff6 h'fffff7 0 tmr_x tcr_x tmr_x tcsr_x tmr_x tmr_x tmr_x tcnt_x tmr_x tmr_x tcora_x tmr_x tcorb_x 1 tmr_y tcr_y tmr_y tcsr_y tmr_y tcora_y tmr_y tcorb_y tmr_y tcnt_y tmr_y
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 302 of 862 rej09b0429-0100 11.3 operation timing 11.3.1 tcnt count timing figure 11.3 shows the tcnt count timing with an internal clock source. external clock input pin tcnt input clock tcnt n ? 1 n n + 1 figure 11.3 count timing for internal clock input 11.3.2 timing of cmfa and cmfb setting at compare-match the cmfa and cmfb flags in tcsr are set to 1 by a compare-match signal generated when the tcnt and tcor values match. the compare-match signal is generated at the last state in which the match is true, just when the timer counter is updated. therefore, when tcnt and tcor match, the compare-match signal is not genera ted until the next tcnt input clock. figure 11.4 shows the timing of cmf flag setting. tcnt n n + 1 tcor n compare-match signal cmf figure 11.4 timing of cmf setting at compare-match
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 303 of 862 rej09b0429-0100 11.3.3 timing of counter clear at compare-match tcnt is cleared when compare- match a or compare-match b occurs, depending on the setting of the cclr1 and cclr0 bits in tcr. figure 11.5 shows the timing of clearing the counter by a compare-match. n h'00 compare-match signal tcnt figure 11.5 timing of co unter clear by compare-match 11.3.4 timing of overflow flag (ovf) setting the ovf bit in tcsr is set to 1 when the tcnt overflows (changes from h'ff to h'00). figure 11.6 shows the timing of ovf flag setting. ovf overflow signal tcnt h'ff h'00 figure 11.6 timing of ovf flag setting
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 304 of 862 rej09b0429-0100 11.4 tmr_0 and tmr_1 ca scaded connection if bits cks2 to cks0 in either tcr_0 or tcr_1 are set to b'100, the 8-bit timers of the two channels are cascaded. with this configuration, 16-bit count mode or compare-match count mode can be selected. 11.4.1 16-bit count mode when bits cks2 to cks0 in tcr_0 are set to b'100, the timer functions as a single 16-bit timer with tmr_0 occupying the upper eight bits and tmr_1 occupying the lower eight bits. ? setting of compare-match flags ? the cmf flag in tcsr_0 is set to 1 when a 16-bit compare-match occurs. ? the cmf flag in tcsr_1 is set to 1 when a lower 8-bit compare-match occurs. ? counter clear specification ? if the cclr1 and cclr0 bits in tcr_0 have been set for counter clear at compare-match, the 16-bit counter (tcnt_0 and tcnt_1 together) is cleared when a 16-bit compare- match occurs. the 16-bit counter (tcnt_0 an d tcnt_1 together) is also cleared when counter clear by the tmi0 pin has been set. ? the settings of the cclr1 and cclr0 bits in tcr_1 are ignored. the lower 8 bits cannot be cleared independently. 11.4.2 compare-match count mode when bits cks2 to cks0 in tcr_1 are b 100, tcnt_1 counts the occurrence of compare-match a for tmr_0. tmr_0 and tmr_1 are controlled independently. conditions such as setting of the cmf flag, generation of interrupt s, and counter clearing are in accordance with th e settings for each channel.
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 305 of 862 rej09b0429-0100 11.5 interrupt sources tmr_0, tmr_1, tmr_y and tmr_x can generate three types of interrupts: cmia, cmib, and ovi. table 11.3 shows the interrupt sources and priorities. each interrupt source can be enabled or disabled independently by interrupt enable bits in tcr or tcsr. independent signals are sent to the interrupt controller for each interrupt. the cmia and cmib interrupts can be used as on-chip dtc activation interrupt sources. table 11.3 interrupt sources of 8-bit timers tmr_0, tmr_1, tmr_y, and tmr_x channel name interrupt source interrupt flag dtc activation interrupt priority tmr_x cmiax tcora_x compare-match cmfa possible high cmibx tcorb_x compare-match cmfb possible ovix tcnt_x overflow ovf not possible tmr_0 cmia0 tcora_0 compare-match cmfa possible cmib0 tcorb_0 compare-match cmfb possible ovi0 tcnt_0 overflow ovf not possible tmr_1 cmia1 tcora_1 compare-match cmfa possible cmib1 tcorb_1 compare-match cmfb possible ovi1 tcnt_1 overflow ovf not possible tmr_y cmiay tcora_y compare-match cmfa possible cmiby tcorb_y compare-match cmfb possible oviy tcnt_y overflow ovf not possible low
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 306 of 862 rej09b0429-0100 11.6 usage notes 11.6.1 conflict between tcnt write and counter clear if a counter clear signal is generated during the t 2 state of a tcnt write cycle as shown in figure 11.7, the counter clear takes priority and the write is not performed. address tcnt address internal write signal counter clear signal tcnt n h'00 t 1 t 2 tcnt write cycle by cpu figure 11.7 conflict between tcnt write and counter clear
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 307 of 862 rej09b0429-0100 11.6.2 conflict between tcnt write and increment if a tcnt input clock is generated during the t 2 state of a tcnt write cycle as shown in figure 11.8, the write takes priority and the counter is not incremented. address tcnt address internal write signal tcnt input clock tcnt n m t 1 t 2 tcnt write cycle by cpu counter write data figure 11.8 conflict between tcnt write and increment
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 308 of 862 rej09b0429-0100 11.6.3 conflict between tcor write and compare-match if a compare-match occurs during the t 2 state of a tcor write cycle as shown in figure 11.9, the tcor write takes priority and the compare-match signal is disabled. address tcor address internal write signal tcnt tcor n m t 1 t 2 tcor write cycle by cpu tcor write data n n + 1 compare-match signal disabled figure 11.9 conflict between tcor write and compare-match
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 309 of 862 rej09b0429-0100 11.6.4 switching of internal clocks and tcnt operation tcnt may increment erroneously when the internal clock is switched over. table 11.4 shows the relationship between the timing at which the internal clock is switched (by writing to the cks1 and cks0 bits) and the tcnt operation. when the tcnt clock is generated from an internal clock, the falling edge of the internal clock pulse is detected. if clock switching causes a change from high to low level, as shown in no. 3 in table 11.4, a tcnt clock pulse is generated on the assumption that the switchover is a falling edge, and tcnt is incremented. erroneous incrementation can also happen when switching between internal and external clocks. table 11.4 switching of internal clocks and tcnt operation no. timing of switchover by means of cks1 and cks0 bits tcnt clock operation 1 clock switching from low to low level * 1 clock before switchover clock after switchover tcnt clock tcnt cks bit rewrite n n + 1 2 clock switching from low to high level ? 2 clock before switchover clock after switchover tcnt clock tcnt cks bit rewrite n n + 1 n + 2
section 11 8-bit timer (tmr) rev. 1.00 mar. 17, 2008 page 310 of 862 rej09b0429-0100 no. timing of switchover by means of cks1 and cks0 bits tcnt clock operation 3 clock switching from high to low level ? 3 clock before switchover clock after switchover tcnt clock tcnt cks bit rewrite n n + 1 n + 2 * 4 4 clock switching from high to high level clock before switchover clock after switchover tcnt clock tcnt cks bit rewrite n n + 1 n + 2 notes: 1. includes switching from low to stop, and from stop to low. 2. includes switching from stop to high. 3. includes switching from high to stop. 4. generated on the assumption that the switchover is a falling edge; tcnt is incremented. 11.6.5 mode setting with cascaded connection if the 16-bit count mode and compare-match count mode are set simultaneously, the input clock pulses for tcnt_0 and tcnt_1 are not generated, and thus the counters will stop operating. simultaneous setting of these two modes should be avoided.
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 311 of 862 rej09b0429-0100 section 12 watchdog timer (wdt) this lsi has two watchdog timer channels (wdt_0 and wdt_1). the watchdog timer can output an overflow signal ( reso ) externally if a system crash pr events the cpu from writing to the timer counter, thus allowing it to overflow. simulta neously, it can generate an internal reset signal or an internal nmi interrupt signal. when this watchdog function is not needed, the wdt can be used as an interval timer. in interval timer operation, an interval timer interrupt is generated each time the counter overflows. a block diagram of the wdt_0 and wdt_1 are shown in figure 12.1. 12.1 features ? selectable from eight (wdt_0) or 16 (wdt_1) counter input clocks. ? switchable between watchdog timer mode and interval timer mode watchdog timer mode: ? if the counter overflows, an internal reset or an internal nmi interrupt is generated. ? when the lsi is selected to be internally reset at counter overflow, a low level signal is output from the reso pin if the counter overflows. internal timer mode: ? if the counter overflows, an internal timer interrupt (wovi) is generated.
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 312 of 862 rej09b0429-0100 wovi0 (interrupt request signal) internal nmi (interrupt request signal * 2 ) reso signal * 1 internal reset signal * 1 tcnt_0 tcsr_0 /2 /64 /128 /512 /2048 /8192 /32768 /131072 internal clock overflow interrupt control reset control wovi1 (interrupt request signal) internal reset signal * 1 reso signal * 1 tcnt_1 tcsr_1 /2 /64 /128 /512 /2048 /8192 /32768 /131072 clock clock selection internal clock bus interface module bus tcsr_0: timer control/status register_0 tcnt_0: timer counter_0 tcsr_1: timer control/status register_1 tcnt_1: timer counter_1 notes: 1. the reso signal outputs the low level signal when the internal reset signal is generated due to a tcnt overflow of either wdt_0 or wdt_1. the internal reset signal first resets the wdt in which the overflow has occurred first. 2. the internal nmi interrupt signal can be independently output from either wdt_0 or wdt_1. the interrupt controller does not distinguish the nmi interrupt request from wdt_0 from that from wdt_1. internal bus wdt_1 [legend] internal nmi (interrupt request signal * 2 ) sub/2 sub/4 sub/8 sub/16 sub/32 sub/64 sub/128 sub/256 overflow interrupt control reset control clock clock selection bus interface module bus internal bus wdt_0 figure 12.1 block diagram of wdt
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 313 of 862 rej09b0429-0100 12.2 input/output pins the wdt has the pins listed in table 12.1. table 12.1 pin configuration name symbol i/o function reset output pin reso output outputs the counter overflow signal in watchdog timer mode external sub-clock input pin excl input inputs the clock pulses to the wdt_1 prescaler counter 12.3 register descriptions the wdt has the following registers. to preven t accidental overwriting, tcsr and tcnt have to be written to in a method different from normal registers. for details, see section 12.6.1, notes on register access. for details on the system control register, see section 3.2.2, system control register (syscr). ? timer counter (tcnt) ? timer control/status register (tcsr) 12.3.1 timer counter (tcnt) tcnt is an 8-bit readable/writa ble up-counter. tcnt is initialized to h'00 when the tme bit in timer control/status register (tcsr) is cleared to 0.
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 314 of 862 rej09b0429-0100 12.3.2 timer control/sta tus register (tcsr) tcsr selects the clock source to be input to tcnt, and the timer mode. ? tcsr_0 bit bit name initial value r/w description 7 ovf 0 r/(w) * overflow flag indicates that tcnt has overflowed (changes from h'ff to h'00). [setting conditions] ? when tcnt overflows (changes from h'ff to h'00) ? when internal reset request generation is selected in watchdog timer mode, ovf is cleared automatically by the internal reset. [clearing conditions] ? when tcsr is read when ovf = 1, then 0 is written to ovf ? when 0 is written to tme 6 wt/ it 0 r/w timer mode select selects whether the wdt is used as a watchdog timer or interval timer. 0: interval timer mode 1: watchdog timer mode 5 tme 0 r/w timer enable when this bit is set to 1, tcnt starts counting. when this bit is cleared, tcnt stops counting and is initialized to h'00. 4 ? 0 r/w reserved the initial value should not be changed. 3 rst/ nmi 0 r/w reset or nmi selects to request an internal reset or an nmi interrupt when tcnt has overflowed. 0: an nmi interrupt is requested 1: an internal reset is requested
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 315 of 862 rej09b0429-0100 bit bit name initial value r/w description 2 to 0 cks2 to cks0 all 0 r/w clock select 2 to 0 select the clock source to be input to tcnt. the overflow period for = 34 mhz is enclosed in parentheses. 000: /2 (period: 15.1 s) 001: /64 (period: 481.9 s) 010: /128 (period: 963.8 s) 011: /512 (period: 3.856 ms) 100: /2048 (period: 15.42 ms) 101: /8192 (period: 61.68 ms) 110: /32768 (period: 246.7 ms) 111: /131072 (period: 986.9 ms) note: * only 0 can be written to clear the flag.
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 316 of 862 rej09b0429-0100 ? tcsr_1 bit bit name initial value r/w description 7 ovf 0 r/(w) * 1 overflow flag indicates that tcnt has overflowed (changes from h'ff to h'00). [setting conditions] ? when tcnt overflows (changes from h'ff to h'00) ? when internal reset request generation is selected in watchdog timer mode, ovf is cleared automatically by the internal reset. [clearing conditions] ? when tcsr is read when ovf = 1 * 2 , then 0 is written to ovf ? when 0 is written to tme 6 wt/ it 0 r/w timer mode select selects whether the wdt is used as a watchdog timer or interval timer. 0: interval timer mode 1: watchdog timer mode 5 tme 0 r/w timer enable when this bit is set to 1, tcnt starts counting. when this bit is cleared, tcnt stops counting and is initialized to h'00. 4 pss 0 r/w prescaler select selects the clock source to be input to tcnt. 0: counts the divided cycle of ?based prescaler (psm) 1: counts the divided cycle of sub?based prescaler (pss) 3 rst/ nmi 0 r/w reset or nmi selects to request an internal reset or an nmi interrupt when tcnt has overflowed. 0: an nmi interrupt is requested 1: an internal reset is requested
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 317 of 862 rej09b0429-0100 bit bit name initial value r/w description 2 to 0 cks2 to cks0 all 0 r/w clock select 2 to 0 select the clock source to be input to tcnt. the overflow cycle for = 34 mhz and sub = 32.768 khz is enclosed in parentheses. when pss = 0: 000: /2 (cycle: 15.1 s) 001: /64 (cycle: 481.9 s) 010: /128 (cycle: 963.8 s) 011: /512 (cycle: 3.856 ms) 100: /2048 (cycle: 15.42 ms) 101: /8192 (cycle: 61.68 ms) 110: /32768 (cycle: 246.7 ms) 111: /131072 (cycle: 986.9 ms) when pss = 1: 000: sub/2 (cycle: 15.6 ms) 001: sub/4 (cycle: 31.3 ms) 010: sub/8 (cycle: 62.5 ms) 011: sub/16 (cycle: 125 ms) 100: sub/32 (cycle: 250 ms) 101: sub/64 (cycle: 500 ms) 110: sub/128 (cycle: 1 s) 111: sub/256 (cycle: 2 s) notes: 1. only 0 can be written to clear the flag. 2. when ovf is polled with the interval timer interrupt disabled, ovf = 1 must be read at least twice.
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 318 of 862 rej09b0429-0100 12.4 operation 12.4.1 watchdog timer mode to use the wdt as a watchdog timer, set the wt/ it bit and the tme bit in tcsr to 1. while the wdt is used as a watchdog timer, if tcnt overflows without being rewritten because of a system malfunction or another error, an internal reset or nmi interrupt request is generated. tcnt does not overflow while the system is operating normally. software must prevent tcnt overflows by rewriting the tcnt value (normally be writing h'00) before overflows occurs. if the rst/ nmi bit of tcsr is set to 1, when the tcnt overflows, an internal reset signal for this lsi is issued for 518 system clocks, and the low level signal is simultaneously output from the reso pin for 132 states, as shown in figure 12.2. if the rst/ nmi bit is cleared to 0, when the tcnt overflows, an nmi interrupt request is generated. here, the output from the reso pin remains high. an internal reset request from the watchdog timer and a reset input from the res pin are processed in the same vector. reset source can be identified by the xrst bit status in syscr. if a reset caused by a signal input to the res pin occurs at the same time as a reset caused by a wdt overflow, the res pin reset has priority and the xrst bit in syscr is set to 1. an nmi interrupt request from the watchdog timer and an interrupt request from the nmi pin are processed in the same vector. do not handle an nmi interrupt request from the watchdog timer and an interrupt request from the nmi pin at the same time.
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 319 of 862 rej09b0429-0100 tcnt value h'00 time h'ff wt/ it = 1 tme = 1 write h'00 to tcnt wt/ it = 1 tme = 1 write h'00 to tcnt 518 system clocks internal reset signal wt/ it : tme: ovf: overflow ovf = 1 * timer mode select bit timer enable bit overflow flag note: * after the ovf bit becomes 1, it is cleared to 0 by an internal reset. the xrst bit is also cleared to 0. figure 12.2 watchdog timer mode (rst/ nmi = 1) operation
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 320 of 862 rej09b0429-0100 12.4.2 interval timer mode when the wdt is used as an in terval timer, an interval timer interrupt (wovi) is generated each time the tcnt overflows, as shown in figure 12.3. therefore, an interrupt can be generated at intervals. when the tcnt overflows in interval timer mode, an interval timer interrupt (wovi) is requested at the same time the ovf bit of tcsr is set to 1. the timing is shown in figure 12.4. tcnt value h'00 time h'ff wt/ it = 0 tme = 1 wovi overflow overflow overflow overflow wovi : interval timer interrupt request occurrence wovi wovi wovi figure 12.3 interval timer mode operation tcnt h'ff h'00 overflow signal (internal signal) ovf figure 12.4 ovf flag set timing
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 321 of 862 rej09b0429-0100 12.4.3 reso signal output timing when tcnt overflows in watchdog timer mode, the ovf bit in tcsr is set to 1. when the rst/ nmi bit is 1 here, the internal reset signal is generated for the entire lsi. at the same time, the low level signal is output from the reso pin. the timing is shown in figure 12.5. tcnt h'ff h'00 132 states 518 states overflow signal (internal signal) ovf reso signal internal reset signal figure 12.5 output timing of reso signal this lsi has retain state pins, which are only initialized by a system reset. the outputs on these pins are retained even when an internal reset is generated by the overflow signal of the wdt. for more information, see section 8, i/o ports.
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 322 of 862 rej09b0429-0100 12.5 interrupt sources during interval timer mode operation, an overflow generates an interval timer interrupt (wovi). the interval timer interrupt is requested whenever the ovf flag is set to 1 in tcsr. ovf must be cleared to 0 in the interrupt handling routine. when the nmi interrupt request is selected in watchdog timer mode, an nmi interrupt request is generated by an overflow table 12.2 wdt interrupt source name interrupt source interrupt flag dtc activation wovi tcnt overflow ovf not possible
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 323 of 862 rej09b0429-0100 12.6 usage notes 12.6.1 notes on register access the watchdog timer?s registers, tcnt and tcsr differ from other registers in being more difficult to write to. the procedures for writing to and reading from these registers are given below. writing to tcnt and tcsr (example of wdt_0): these registers must be written to by a word transfer instruction. they cannot be written to by a byte transfer instruction. tcnt and tcsr both have the same write address. therefore, satisfy the relative condition shown in figure 12.6 to write to tcnt or tcsr. to write to tcnt, the higher bytes must contain the value h'5a and the lower bytes must contain the write data. to write to tcsr, the higher bytes must contain the value h'a5 and the lower bytes must contain the write data. address : h'ffa8 address : h'ffa8 h'5a write data 15 8 7 0 h'a5 write data 15 8 7 0 figure 12.6 writing to tcnt and tcsr (wdt_0) reading from tcnt and tcsr (example of wdt_0): these registers are read in the same way as othe r registers. the read address is h'ffa8 for tcsr and h'ffa9 for tcnt.
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 324 of 862 rej09b0429-0100 12.6.2 conflict between timer counter (tcnt) write and increment if a timer counter clock pulse is generated during the t 2 state of a tcnt write cycle, the write takes priority and the timer counter is not incremented. figure 12.7 shows this operation. address internal write signal tcnt input clock tcnt n m t 1 t 2 tcnt write cycle counter write data figure 12.7 conflict between tcnt write and increment 12.6.3 changing values of cks2 to cks0 bits if cks2 to cks0 bits in tcsr are written to while the wdt is operating, errors could occur in the incrementation. software must stop the watchdog timer (by clearing the tme bit to 0) before changing the values of cks2 to cks0 bits. 12.6.4 changing value of pss bit if the pss bit in tcsr_1 is written to while the wdt is operating, errors could occur in the operation. stop the watchdog timer (by clearing the tme bit to 0) before changing the values of pss bit.
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 325 of 862 rej09b0429-0100 12.6.5 switching between watchdog timer mode and interval timer mode if the mode is switched from/to watchdog timer to/from interval timer, while the wdt is operating, errors could occur in the operation. software must stop the watchdog timer (by clearing the tme bit to 0) before switching the mode. 12.6.6 system reset by reso signal inputting the reso output signal to the res pin of this lsi prevents the lsi from being initialized correctly; the reso signal must not be logically connected to the res pin of the lsi. to reset the entire system by the reso signal, use the circuit as shown in figure 12.8. res reso this lsi reset input reset signal for entire system figure 12.8 sample circuit fo r resetting the system by the reso signal
section 12 watchdog timer (wdt) rev. 1.00 mar. 17, 2008 page 326 of 862 rej09b0429-0100
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 327 of 862 rej09b0429-0100 section 13 serial communication interface (sci) this lsi has two independent serial communication interface (sci) channels. the sci can handle both asynchronous and clock synchronous serial communication. asynchronous serial data communication can be carried out with standard asynchronous communication chips such as a universal asynchronous receiver/transmitte r (uart) or asynchronous communication interface adapter (acia). a function is also provided for serial communication between processors (multiprocessor communication functio n). the sci also supports the smart card (ic card) interface based on iso/iec 7816-3 (identification card) as an enhanced asynchronous communication function. 13.1 features ? choice of asynchronous or clock synchronous serial communication mode ? full-duplex communication capability the transmitter and receiver are mutually indepe ndent, enabling transmission and reception to be executed simultaneously. double-buffering is used in both the transmitter and the receiver, enabling continuous transmission and c ontinuous reception of serial data. ? on-chip baud rate generator allows any bit rate to be selected the external clock can be selected as a tr ansfer clock source (except for the smart card interface). ? choice of lsb-first or msb-first transfer (except in the case of asynchronous mode 7-bit data) ? four interrupt sources four interrupt sources ? transmit-end, transmit-data-empty , receive-data-full, and receive error ? that can issue requests. the transmit-data-empty and receive-data- full interrupt sources can activate dtc. ? module stop mode availability
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 328 of 862 rej09b0429-0100 asynchronous mode: ? data length: 7 or 8 bits ? stop bit length: 1 or 2 bits ? parity: even, odd, or none ? receive error detection: parity , overrun, and framing errors ? break detection: break can be detected by reading the rxd pin level directly in case of a framing error clock synchronous mode: ? data length: 8 bits ? receive error detecti on: overrun errors smart card interface: ? an error signal can be automatically transmitted on detection of a parity error during reception ? data can be automatically re-transmitted on detection of a error signal during transmission ? both direct convention and inverse convention are supported
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 329 of 862 rej09b0429-0100 figure 13.1 is a block diagram of sci_1 and sci_3. rxd1/rxd3 txd1/txd3 sck1/sck3 clock /4 /16 /64 tei txi rxi eri scmr ssr scr smr transmission/ reception control baud rate generator brr module data bus rdr tsr rsr parity generation parity check [legend] rsr: receive shift register rdr: receive data register tsr: transmit shift register tdr: transmit data register smr: serial mode register tdr bus interface internal data bus external clock scr: serial control register ssr: serial status register scmr: smart card mode register brr: bit rate register figure 13.1 block diagram of sci_1 and sci_3
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 330 of 862 rej09b0429-0100 13.2 input/output pins table 13.1 shows the input/output pins for each sci channel. table 13.1 pin configuration channel symbol * input/output function sck1 input/output channel 1 clock input/output input channel 1 receive data input rxd1 input/output channel 1 transmit/receive data input/output (when smart card interface is selected) 1 txd1 output channel 1 transmit data output sck3 input/output channel 3 clock input/output input channel 3 receive data input rxd3 input/output channel 3 transmit/receive data input/output (when smart card interface is selected) 3 txd3 output channel 3 transmit data output note: * pin names sck, rxd, and txd are used in the text for all channels, omitting the channel designation. 13.3 register descriptions the sci has the following registers for each channel. some bits in the serial mode register (smr), serial status register (ssr), and serial control register (scr) have different functions in different modes ? normal serial communication interface mode and smart card interface mode; therefore, the bits are described separately for each mode in the corresponding register sections. ? receive shift register (rsr) ? receive data register (rdr) ? transmit data register (tdr) ? transmit shift register (tsr) ? serial mode register (smr) ? serial control register (scr) ? serial status register (ssr) ? smart card mode register (scmr) ? bit rate register (brr)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 331 of 862 rej09b0429-0100 13.3.1 receive shift register (rsr) rsr is a shift register used to receive serial da ta that converts it into parallel data. when one frame of data has been received, it is transfer red to rdr automatically. rsr cannot be directly accessed by the cpu. 13.3.2 receive data register (rdr) rdr is an 8-bit register that stores receive da ta. when the sci has received one frame of serial data, it transfers the received serial data from rs r to rdr where it is stor ed. after this, rsr can receive the next data. since rsr and rdr functi on as a double buffer in this way, continuous receive operations be performed. after confirming th at the rdrf bit in ssr is set to 1, read rdr for only once. rdr cannot be written to by the cpu. 13.3.3 transmit data register (tdr) tdr is an 8-bit register that stores transmit data. when the sci detects that tsr is empty, it transfers the transmit data written in tdr to tsr and starts transmission. the double-buffered structures of tdr and tsr enables continuous serial transmission. if the next transmit data has already been written to tdr when one frame of data is transmitted, the sci transfers the written data to tsr to continue transm ission. although tdr can be read from or written to by the cpu at all times, to achieve reliable serial transmission, write transmit data to tdr for only once after confirming that the tdre bit in ssr is set to 1. 13.3.4 transmit shift register (tsr) tsr is a shift register that transmits serial data. to perform serial data transmission, the sci first transfers transmit data from tdr to tsr, then sends the data to the txd pin. tsr cannot be directly accessed by the cpu.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 332 of 862 rej09b0429-0100 13.3.5 serial mode register (smr) smr is used to set the sci?s serial transfer format and select the baud rate generator clock source. some bits in smr have different functions in normal mode and smart card interface mode. ? bit functions in normal seri al communication interface mode (when smif in scmr = 0) bit bit name initial value r/w description 7 c/ a 0 r/w communication mode 0: asynchronous mode 1: clock synchronous mode 6 chr 0 r/w character length (enabled only in asynchronous mode) 0: selects 8 bits as the data length. 1: selects 7 bits as the data length. lsb-first is fixed and the msb of tdr is not transmitted in transmission. in clock synchronous mode, a fixed data length of 8 bits is used. 5 pe 0 r/w parity enable (enabled only in asynchronous mode) when this bit is set to 1, the parity bit is added to transmit data before transmission, and the parity bit is checked in reception. for a multiprocessor format, parity bit addition and checking are not performed regardless of the pe bit setting. 4 o/ e 0 r/w parity mode (enabled only when the pe bit is 1 in asynchronous mode) 0: selects even parity. 1: selects odd parity. 3 stop 0 r/w stop bit length (enabled only in asynchronous mode) selects the stop bit length in transmission. 0: 1 stop bit 1: 2 stop bits in reception, only the first stop bit is checked. if the second stop bit is 0, it is treated as the start bit of the next transmit frame. 2 mp 0 r/w multiprocessor mode (enabled only in asynchronous mode) when this bit is set to 1, the multiprocessor communication function is enabled. the pe bit and o/ e bit settings are invalid in multiprocessor mode.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 333 of 862 rej09b0429-0100 bit bit name initial value r/w description 1 0 cks1 cks0 0 0 r/w r/w clock select 1 and 0 these bits select the clock source for the baud rate generator. 00: clock (n = 0) 01: /4 clock (n = 1) 10: /16 clock (n = 2) 11: /64 clock (n = 3) for the relation between the bit rate register setting and the baud rate, see section 13.3.9, bit rate register (brr). n is the decimal display of the value of n in brr (see section 13.3.9, bit rate register (brr)). ? bit functions in smart card interface mode (when smif in scmr = 1) bit bit name initial value r/w description 7 gm 0 r/w gsm mode setting this bit to 1 allows gsm mode operation. in gsm mode, the tend set timing is put forward to 11.0 etu * from the start and the clock output control function is appended. for details, see section 13.7.8, clock output control. 6 blk 0 r/w setting this bit to 1 allows block transfer mode operation. for details, see section 13.7.3, block transfer mode. 5 pe 0 r/w parity enable (valid only in asynchronous mode) when this bit is set to 1, the parity bit is added to transmit data before transmission, and the parity bit is checked in reception. set this bit to 1 in smart card interface mode. 4 o/ e 0 r/w parity mode (valid only when the pe bit is 1 in asynchronous mode) 0: selects even parity 1: selects odd parity for details on the usage of this bit in smart card interface mode, see section 13.7.2, data format (except in block transfer mode).
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 334 of 862 rej09b0429-0100 bit bit name initial value r/w description 3 2 bcp1 bcp0 0 0 r/w r/w basic clock pulse 1 and 0 these bits select the number of basic clock cycles in a 1- bit data transfer time in smart card interface mode. 00: 32 clock cycles (s = 32) 01: 64 clock cycles (s = 64) 10: 372 clock cycles (s = 372) 11: 256 clock cycles (s = 256) for details, see section 13.7.4, receive data sampling timing and reception margin. s is described in section 13.3.9, bit rate register (brr). 1 0 cks1 cks0 0 0 r/w r/w clock select 1 and 0 these bits select the clock source for the baud rate generator. 00: clock (n = 0) 01: /4 clock (n = 1) 10: /16 clock (n = 2) 11: /64 clock (n = 3) for the relation between the bit rate register setting and the baud rate, see section 13.3.9, bit rate register (brr). n is the decimal display of the value of n in brr (see section 13.3.9, bit rate register (brr)). note: * etu: element time unit (time taken to transfer one bit)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 335 of 862 rej09b0429-0100 13.3.6 serial control register (scr) scr is a register that performs enabling or disabling of sci transfer operations and interrupt requests, and selection of the transfer clock source. for details on interrupt requests, see section 13.8, interrupt sources. some bits in scr have different functions in normal mode and smart card interface mode. ? bit functions in normal seri al communication interface mode (when smif in scmr = 0) bit bit name initial value r/w description 7 tie 0 r/w transmit interrupt enable when this bit is set to 1, a txi interrupt request is enabled. 6 rie 0 r/w receive interrupt enable when this bit is set to 1, rxi and eri interrupt requests are enabled. 5 te 0 r/w transmit enable when this bit is set to 1, transmission is enabled. 4 re 0 r/w receive enable when this bit is set to 1, reception is enabled. 3 mpie 0 r/w multiprocessor interrupt enable (enabled only when the mp bit in smr is 1 in asynchronous mode) when this bit is set to 1, receive data in which the multiprocessor bit is 0 is skipped, and setting of the rdrf, fer, and orer status flags in ssr is disabled. on receiving data in which the multiprocessor bit is 1, this bit is automatically cleared and normal reception is resumed. for details, see section 13.5, multiprocessor communication function. 2 teie 0 r/w transmit end interrupt enable when this bit is set to 1, a tei interrupt request is enabled.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 336 of 862 rej09b0429-0100 bit bit name initial value r/w description 1 0 cke1 cke0 0 0 r/w r/w clock enable 1 and 0 these bits select the clock source and sck pin function. asynchronous mode: 00: internal clock (sck pin functions as i/o port.) 01: internal clock (outputs a clock of the same frequency as the bit rate from the sck pin.) 1x: external clock (inputs a clock with a frequency 16 times the bit rate from the sck pin.) clock synchronous mode: 0x: internal clock (sck pin functions as clock output.) 1x: external clock (sck pin functions as clock input.) [legend] x: don't care
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 337 of 862 rej09b0429-0100 ? bit functions in smart card interface mode (when smif in scmr = 1) bit bit name initial value r/w description 7 tie 0 r/w transmit interrupt enable when this bit is set to 1, a txi interrupt request is enabled. 6 rie 0 r/w receive interrupt enable when this bit is set to 1, rxi and eri interrupt requests are enabled. 5 te 0 r/w transmit enable when this bit is set to 1, transmission is enabled. 4 re 0 r/w receive enable when this bit is set to 1, reception is enabled. 3 mpie 0 r/w multiprocessor interrupt enable (enabled only when the mp bit in smr is 1 in asynchronous mode) write 0 to this bit in smart card interface mode. 2 teie 0 r/w transmit end interrupt enable write 0 to this bit in smart card interface mode. 1 0 cke1 cke0 0 0 r/w r/w clock enable 1 and 0 these bits control the clock output from the sck pin. in gsm mode, clock output can be dynamically switched. for details, see section 13.7.8, clock output control. when gm in smr = 0 00: output disabled (sck pin functions as i/o port.) 01: clock output 1x: reserved when gm in smr = 1 00: output fixed to low 01: clock output 10: output fixed to high 11: clock output [legend] x: don't care
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 338 of 862 rej09b0429-0100 13.3.7 serial status register (ssr) ssr is a register containing status flags of the sci and multiprocessor bits for transfer. tdre, rdrf, orer, per, and fer can only be cleared. some bits in ssr have different functions in normal mode and smart card interface mode. ? bit functions in normal seri al communication interface mode (when smif in scmr = 0) bit bit name initial value r/w description 7 tdre 1 r/(w) * transmit data register empty indicates whether tdr contains transmit data. [setting conditions] ? when the te bit in scr is 0 ? when data is transferred from tdr to tsr and tdr is ready for data write [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when a txi interrupt request is issued allowing dtc to write data to tdr 6 rdrf 0 r/(w) * receive data register full indicates that receive data is stored in rdr. [setting condition] ? when serial reception ends normally and receive data is transferred from rsr to rdr [clearing conditions] ? when 0 is written to rdrf after reading rdrf = 1 ? when an rxi interrupt request is issued allowing dtc to read data from rdr the rdrf flag is not affected and retains its previous value when the re bit in scr is cleared to 0.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 339 of 862 rej09b0429-0100 bit bit name initial value r/w description 5 orer 0 r/(w) * overrun error [setting condition] when the next serial reception is completed while rdrf = 1 [clearing condition] when 0 is written to orer after reading orer = 1 4 fer 0 r/(w) * framing error [setting condition] when the stop bit is 0 [clearing condition] when 0 is written to fer after reading fer = 1 in 2-stop-bit mode, only the first stop bit is checked. 3 per 0 r/(w) * parity error [setting condition] when a parity error is detected during reception [clearing condition] when 0 is written to per after reading per = 1 2 tend 1 r transmit end [setting conditions] ? when the te bit in scr is 0 ? when tdre = 1 at transmission of the last bit of a 1- byte serial transmit character [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when a txi interrupt request is issued allowing dtc to write data to tdr 1 mpb 0 r multiprocessor bit mpb stores the multiprocessor bit in the receive frame. when the re bit in scr is cleared to 0, its previous state is retained. 0 mpbt 0 r/w multiprocessor bit transfer mpbt stores the multiprocessor bit to be added to the transmit frame. note: * only 0 can be written to clear the flag.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 340 of 862 rej09b0429-0100 ? bit functions in smart card interface mode (when smif in scmr = 1) bit bit name initial value r/w description 7 tdre 1 r/(w) * 1 transmit data register empty indicates whether tdr contains transmit data. [setting conditions] ? when the te bit in scr is 0 ? when data is transferred from tdr to tsr, and tdr can be written to. [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when a txi interrupt request is issued allowing dtc to write data to tdr 6 rdrf 0 r/(w) * 1 receive data register full indicates whether the receive data is stored in rdr. [setting condition] ? when serial reception ends normally and receive data is transferred from rsr to rdr [clearing conditions] ? when 0 is written to rdrf after reading rdrf = 1 ? when an rxi interrupt request is issued allowing dtc to read data from rdr the rdrf flag is not affected and retains its previous value when the re bit in scr is cleared to 0. 5 orer 0 r/(w) * 1 overrun error [setting condition] when the next serial reception is completed while rdrf = 1 [clearing condition] when 0 is written to orer after reading orer = 1 4 ers 0 r/(w) * 1 error signal status [setting condition] when a low error signal is sampled [clearing condition] when 0 is written to ers after reading ers = 1
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 341 of 862 rej09b0429-0100 bit bit name initial value r/w description 3 per 0 r/(w) * 1 parity error [setting condition] when a parity error is detected during reception [clearing condition] when 0 is written to per after reading per = 1 2 tend 1 r transmit end tend is set to 1 when the receiving end acknowledges no error signal and the next transmit data is ready to be transferred to tdr. [setting conditions] ? when both te in scr and ers are 0 ? when ers = 0 and tdre = 1 after a specified time passed after the start of 1-byte data transfer. the set timing depends on the register setting as follows. when gm = 0 and blk = 0, 2.5 etu * 2 after transmission start when gm = 0 and blk = 1, 1.5 etu * 2 after transmission start when gm = 1 and blk = 0, 1.0 etu * 2 after transmission start when gm = 1 and blk = 1, 1.0 etu * 2 after transmission start [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when a txi interrupt request is issued allowing dtc to write the next data to tdr 1 mpb 0 r multiprocessor bit not used in smart card interface mode. 0 mpbt 0 r/w multiprocessor bit transfer write 0 to this bit in smart card interface mode. notes: 1. only 0 can be written to clear the flag. 2. etu: element time unit (time taken to transfer one bit)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 342 of 862 rej09b0429-0100 13.3.8 smart card mode register (scmr) scmr selects smart card interface mode and its format. bit bit name initial value r/w description 7 to 4 ? all 1 r reserved these bits are always read as 1 and cannot be modified. 3 sdir 0 r/w smart card data transfer direction selects the serial/parallel conversion format. 0: tdr contents are transmitted with lsb-first. stores receive data as lsb first in rdr. 1: tdr contents are transmitted with msb-first. stores receive data as msb first in rdr. the sdir bit is valid only when the 8-bit data format is used for transmission/reception; when the 7-bit data format is used, data is always transmitted/received with lsb-first. 2 sinv 0 r/w smart card data invert specifies inversion of the data logic level. the sinv bit does not affect the logic level of the parity bit. when the parity bit is inverted, invert the o/ e bit in smr. 0: tdr contents are transmitted as they are. receive data is stored as it is in rdr. 1: tdr contents are inverted before being transmitted. receive data is stored in inverted form in rdr. 1 ? 1 r reserved this bit is always read as 1 and cannot be modified. 0 smif 0 r/w smart card interface mode select when this bit is set to 1, smart card interface mode is selected. 0: normal asynchronous or clock synchronous mode 1: smart card interface mode
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 343 of 862 rej09b0429-0100 13.3.9 bit rate register (brr) brr is an 8-bit register that adjusts the bit rate. as the sci performs baud rate generator control independently for each channel, different bit rate s can be set for each channel. table 13.2 shows the relationships between the n setting in brr and bit rate b for normal asynchronous mode and clock synchronous mode, and smart card interface mode. the initial value of brr is h ff, and it can be read from or written to by the cpu at all times. table 13.2 relationships between n setting in brr and bit rate b mode bit rate error asynchronous mode b = 64 2 (n + 1) 2n ? 1 10 6 error (%) = { ? 1 } 100 b 64 2 (n + 1) 2n ? 1 10 6 clock synchronous mode b = 8 2 (n + 1) 2n ? 1 10 6 ? smart card interface mode b = s 2 (n + 1) 2n + 1 10 6 error (%) = b s 2 (n + 1) ?1 100 2n + 1 10 6 { } [legend] b: bit rate (bit/s) n: brr setting for baud rate generator (0 n 255) : operating frequency (mhz) n and s: determined by the smr settings shown in the following table. smr setting smr setting cks1 cks0 n bcp1 bcp0 s 0 0 0 0 0 32 0 1 1 0 1 64 1 0 2 1 0 372 1 1 3 1 1 256 table 13.3 shows sample n settings in brr in normal asynchronous mode. table 13.4 shows the maximum bit rate settable for each frequency. table 13.6 and 13.8 show sample n settings in brr in clock synchronous mode and smart card interface mode, respectively. in smart card interface mode, the number of basic clock cycles s in a 1-bit data transfer time can be selected. for details, see section 13.7.4, receive data sampling timing and recepti on margin. tables 13.5 and 13.7 show the maximum bit rates with external clock input.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 344 of 862 rej09b0429-0100 table 13.3 examples of brr settings for various bit rates (asynchronous mode) operating frequency (mhz) 20 25 34 bit rate (bit/s) n n error (%) n n error (%) n n error (%) 110 3 88 ?0.25 3 110 ?0.02 3 150 ?0.05 150 3 64 0.16 3 80 ?0.47 3 110 ?0.29 300 2 129 0.16 2 162 0.15 2 220 0.16 600 2 64 0.16 2 80 ?0.47 2 110 ?0.29 1200 1 129 0.16 1 162 0.15 1 220 0.16 2400 1 64 0.16 1 80 ?0.47 1 110 ?0.29 4800 0 129 0.16 0 162 0.15 0 220 0.16 9600 0 64 0.16 0 80 ?0.47 0 110 ?0.29 19200 0 32 ?1.36 0 40 ?0.76 0 54 0.62 31250 0 19 0.00 0 24 0.00 0 33 0.00 38400 0 15 1.73 0 19 1.73 0 27 ?1.18 [legend] ? : can be set, but there will be a degree of error. note: make the settings so that the error does not exceed 1%. table 13.4 maximum bit rate for each frequency (asynchronous mode) (mhz) maximum bit rate (bit/s) n n 20 625000 0 0 25 781250 0 0 34 1062500 0 0 table 13.5 maximum bit rate with external clock input (asynchronous mode) (mhz) external input clock (m hz) maximum bit rate (bit/s) 20 5.0000 312500 25 6.2500 390625 34 8.0000 531250
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 345 of 862 rej09b0429-0100 table 13.6 brr settings for various bit rates (clock synchronous mode) operating frequency (mhz) 20 24 34 bit rate (bit/s) n n n n n n 110 250 500 ? ? ? ? ? ? 1 k ? ? ? ? ? ? 2.5 k 2 124 2 149 2 2 12 5 k 1 249 2 74 2 105 10 k 1 124 1 149 1 2 12 25 k 0 199 0 2 39 1 84 50 k 0 99 0 119 0 169 100 k 0 49 0 59 0 84 250 k 0 19 0 2 3 0 33 500 k 0 9 0 11 0 16 1 m 0 4 0 5 2.5 m 0 1 5 m 0 0 * [legend] blank: setting prohibited. ? : can be set, but there will be a degree of error. * : continuous transfer or reception is not possible.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 346 of 862 rej09b0429-0100 table 13.7 maximum bit rate with external clock input (clock synchronous mode) (mhz) external input clock (m hz) maximum bit rate (bit/s) 20 3.3333 3333333.3 25 4.1667 4166666.7 34 5.6667 5666666.7 table 13.8 brr settings for various bit rates (smart card interface mode, n = 0, s = 372) operating frequency (mhz) 20.00 21.4272 25 34 bit rate (bit/s) n n error (%) n n error(%) n n error (%) n n error (%) 9600 0 2 ?6.65 0 2 0.00 0 3 ?12.49 0 4 ?4.79 table 13.9 maximum bit rate for each frequency (smart card interface mode, s = 372) (mhz) maximum bit rate (bit/s) n n 20.00 26882 0 0 21.4272 28800 0 0 25.00 33602 0 0 34.00 45699 0 0
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 347 of 862 rej09b0429-0100 13.4 operation in as ynchronous mode figure 13.2 shows the general format for asynchronous serial communication. one frame consists of a start bit (low level), followed by transmit/receive data, a parity bit, and finally stop bits (high level). in asynchronous serial communication, the transmission line is usually held in the mark state (high level). the sci monito rs the transmission line, and when it goes to the space state (low level), recognizes a start bit and starts serial communication. inside the sci, the transmitter and receiver are independent units, enabling full-duplex communication. both the transmitter and the receiver also have a double-buffered structure, so that data can be read or written during transmission or reception, enabling c ontinuous data transfer and reception. lsb start bit msb idle state (mark state) stop bit 0 transmit/receive data d0 d1 d2 d3 d4 d5 d6 d7 0/1 1 1 1 1 serial data parity bit 1 bit 1 or 2 bits 7 or 8 bits 1 bit or none one unit of transfer data (character or frame) figure 13.2 data format in asynchronous communication (example with 8-bit data, parity, two stop bits)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 348 of 862 rej09b0429-0100 13.4.1 data transfer format table 13.10 shows the data transfer formats that can be used in asynchronous mode. any of 12 transfer formats can be selected according to the smr setting. for details on the multiprocessor bit, see section 13.5, multiprocessor communication function. table 13.10 serial transfer formats (asynchronous mode) pe 0 0 1 1 0 0 1 1 ? ? ? ? s 8-bit data stop s 7-bit data stop s 8-bit data stop stop s 8-bit data p stop s 7-bit data stop p s 8-bit data mpb stop s 8-bit data mpb stop stop s 7-bit data stop mpb s 7-bit data stop mpb stop s 7-bit data stop stop chr 0 0 0 0 1 1 1 1 0 0 1 1 mp 0 0 0 0 0 0 0 0 1 1 1 1 stop 0 1 0 1 0 1 0 1 0 1 0 1 smr settings 123456789101112 serial transmit/receive format and frame length stop s 8-bit data p stop s 7-bit data stop p stop [legend] s: start bit stop: stop bit p: parity bit mpb: multiprocessor bit
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 349 of 862 rej09b0429-0100 13.4.2 receive data sampling timing and reception margin in asynchronous mode in asynchronous mode, the sci operates on a basic clock with a frequency of 16 times the bit rate. in reception, the sci samples the falling edge of the start bit using the basic clock, and performs internal synchronization. since recei ve data is latched internally at the rising edge of the 8th pulse of the basic clock, data is latched at the middle of each bit, as shown in figure 13.3. thus the reception margin in asynchronous mode is determined by formula (1) below. m = (0.5 ? ) ? (1+f) ? (l ? 0.5) f } 100 [%] ... formula (1) 2n 1 n d ? 0.5 m: n: d: l: f: } reception margin (%) ratio of bit rate to clock (n = 16) clock duty (d = 0.5 to 1.0) frame length (l = 9 to 12) absolute value of clock rate deviation assuming values of f = 0 and d = 0.5 in formula (1), the reception margin is determined by the formula below. m = {0.5 ? 1/(2 16) } 100 [%] = 46.875 % however, this is only the computed value, and a margin of 20% to 30% should be allowed in system design. internal basic clock 16 clocks 8 clocks receive data (rxd) synchronization sampling timing start bit d0 d1 data sampling timing 15 0 7 15 0 0 7 figure 13.3 receive data samplin g timing in asynchronous mode
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 350 of 862 rej09b0429-0100 13.4.3 clock either an internal clock generated by the on-chip baud rate generator or an external clock input at the sck pin can be selected as the sci?s tran sfer clock, according to the setting of the c/ a bit in smr and the cke1 and cke0 bits in scr. when an external clock is input at the sck pin, the clock frequency should be 16 times the bit rate used. when the sci is operated on an internal clock, the clock can be output from the sck pin. the frequency of the clock output in this case is equal to the bit rate, and the phase is such that the rising edge of the clock is in the middle of the transmit data, as shown in figure 13.4. 0 1 frame d0 d1 d2 d3 d4 d5 d6 d7 0/1 1 1 sck txd figure 13.4 relation between output clock and transmit data phase (asynchronous mode)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 351 of 862 rej09b0429-0100 13.4.4 sci initialization (asynchronous mode) before transmitting and receiving data, you should firs t clear the te and re bits in scr to 0, then initialize the sci as shown in figure 13.5. when the operating mode, transfer format, etc., is changed, the te and re bits must be cleared to 0 before making the change using the following procedure. when the te bit is clear ed to 0, the tdre flag in ssr is set to 1. note that clearing the re bit to 0 does not initialize the contents of the rdrf, per, fer, and orer flags in ssr, or the contents of rdr. when the external clock is used in asynchronous mode, the clock must be supplied even during initialization. wait start initialization set data transfer format in smr and scmr [1] set cke1 and cke0 bits in scr (te and re bits are 0) no yes set value in brr clear te and re bits in scr to 0 [2] [3] set te and re bits in scr to 1, and set rie, tie, teie, and mpie bits [4] 1-bit interval elapsed? [1] set the clock selection in scr. be sure to clear bits rie, tie, teie, and mpie, and bits te and re, to 0. when the clock is selected in asynchronous mode, it is output immediately after scr settings are made. [2] set the data transfer format in smr and scmr. [3] write a value corresponding to the bit rate to brr. not necessary if an external clock is used. [4] wait at least one bit interval, then set the te bit or re bit in scr to 1. also set the rie, tie, teie, and mpie bits. setting the te and re bits enables the txd and rxd pins to be used. figure 13.5 sample sci initialization flowchart
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 352 of 862 rej09b0429-0100 13.4.5 serial data transmission (asynchronous mode) figure 13.6 shows an example of the operation for transmission in asynchronous mode. in transmission, the sci operates as described below. 1. the sci monitors the tdre flag in ssr, and if it is cleared to 0, recognizes that data has been written to tdr, and transfers the data from tdr to tsr. 2. after transferring data from tdr to tsr, the sci sets the tdre flag to 1 and starts transmission. if the tie bit in scr is set to 1 at this time, a transmit data empty interrupt request (txi) is generated. because the txi interrupt routine writes the next transmit data to tdr before transmission of the current transmit data has finished, continuous transmission can be enabled. 3. data is sent from the txd pin in the following order: start bit, transmit data, parity bit or multiprocessor bit (may be omitted depending on the format), and stop bit. 4. the sci checks the tdre flag at the timing for sending the stop bit. 5. if the tdre flag is 0, the data is transferred from tdr to tsr, the stop bit is sent, and then serial transmission of the next frame is started. 6. if the tdre flag is 1, the tend flag in ssr is set to 1, the stop bit is sent, and then the ?mark state? is entered in which 1 is output. if the teie bit in scr is set to 1 at this time, a tei interrupt request is generated. figure 13.7 shows a sample flowchart for transmission in asynchronous mode. tdre tend 0 1 frame d0 d1 d7 0/1 1 0 d0 d1 d7 0/1 1 1 1 data start bit parity bit stop bit start bit data parity bit stop bit txi interrupt request generated data written to tdr and tdre flag cleared to 0 in txi interrupt service routine tei interrupt request generated idle state (mark state) txi interrupt request generated figure 13.6 example of operation in transmission in asynchronous mode (example with 8-bit data, parity, one stop bit)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 353 of 862 rej09b0429-0100 no [1] yes initialization start transmission read tdre flag in ssr [2] write transmit data to tdr and clear tdre flag in ssr to 0 no yes no yes read tend flag in ssr [3] no yes [4] clear dr to 0 and set ddr to 1 clear te bit in scr to 0 tdre = 1 all data transmitted? tend = 1 break output? [1] sci initialization: the txd pin is automatically designated as the transmit data output pin. after the te bit is set to 1, a frame of 1s is output, and transmission is enabled. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr and clear the tdre flag to 0. [3] serial transmission continuation procedure: to continue serial transmission, read 1 from the tdre flag to confirm that writing is possible, then write data to tdr, and clear the tdre flag to 0. however, the tdre flag is checked and cleared automatically when the dtc is initiated by a transmit data empty interrupt (txi) request and writes data to tdr. [4] break output at the end of serial transmission: to output a break in serial transmission, set ddr for the port corresponding to the txd pin to 1, clear dr to 0, then clear the te bit in scr to 0. figure 13.7 sample serial transmission flowchart
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 354 of 862 rej09b0429-0100 13.4.6 serial data recepti on (asynchronous mode) figure 13.8 shows an example of the operation fo r reception in asynchronous mode. in serial reception, the sci operates as described below. 1. the sci monitors the communication line, and if a start bit is detected, performs internal synchronization, receives receive data in rs r, and checks the parity bit and stop bit. 2. if an overrun error (when reception of the next data is completed while the rdrf flag in ssr is still set to 1) occurs, the orer bit in ssr is se t to 1. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. recei ve data is not transferred to rdr. the rdrf flag remains to be set to 1. 3. if a parity error is detected, the per bit in ssr is set to 1 and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. 4. if a framing error (when the stop bit is 0) is detected, the fer bit in ssr is set to 1 and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. 5. if reception finishes successfully, the rdrf b it in ssr is set to 1, and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an rxi interrupt request is generated. because the rxi interrupt routine read s the receive data transferred to rdr before reception of the next receive data has fini shed, continuous reception can be enabled. rdrf fer 0 1 frame d0 d1 d7 0/1 1 0 d0 d1 d7 0/1 0 1 1 data start bit parity bit stop bit start bit data parity bit stop bit eri interrupt request generated by framing error idle state (mark state) rdr data read and rdrf flag cleared to 0 in rxi interrupt service routine rxi interrupt request generated figure 13.8 example of sc i operation in reception (example with 8-bit data, parity, one stop bit)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 355 of 862 rej09b0429-0100 table 13.11 shows the states of the ssr status flags and receive data handling when a receive error is detected. if a receive error is detected , the rdrf flag retains its state before receiving data. reception cannot be resumed while a receive er ror flag is set to 1. accordingly, clear the orer, fer, per, and rdrf bits to 0 before resuming reception. figure 13.9 shows a sample flowchart for serial data reception. table 13.11 ssr status flags and receive data handling ssr status flag rdrf * orer fer per receive data receive error type 1 1 0 0 lost overrun error 0 0 1 0 transferred to rdr framing error 0 0 0 1 transferred to rdr parity error 1 1 1 0 lost overrun error + framing error 1 1 0 1 lost overrun error + parity error 0 0 1 1 transferred to rdr framing error + parity error 1 1 1 1 lost overrun error + framing error + parity error note: * the rdrf flag retains the state it had before data reception.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 356 of 862 rej09b0429-0100 yes [1] no initialization start reception [2] no yes read rdrf flag in ssr [4] [5] clear re bit in scr to 0 read orer, per, and fer flags in ssr error processing (continued on next page) [3] read receive data in rdr, and clear rdrf flag in ssr to 0 no yes per fer orer = 1 rdrf = 1 all data received? [1] sci initialization: the rxd pin is automatically designated as the receive data input pin. [2] [3] receive error processing and break detection: if a receive error occurs, read the orer, per, and fer flags in ssr to identify the error. after performing the appropriate error processing, ensure that the orer, per, and fer flags are all cleared to 0. reception cannot be resumed if any of these flags are set to 1. in the case of a framing error, a break can be detected by reading the value of the input port corresponding to the rxd pin. [4] sci status check and receive data read: read ssr and check that rdrf = 1, then read the receive data in rdr and clear the rdrf flag to 0. transition of the rdrf flag from 0 to 1 can also be identified by an rxi interrupt. [5] serial reception continuation procedure: to continue serial reception, before the stop bit for the current frame is received, read the rdrf flag, read rdr, and clear the rdrf flag to 0. however, the rdrf flag is cleared automatically when the dtc is initiated by an rxi interrupt and reads data from rdr. [legend] : logical add (or) figure 13.9 sample serial reception fl owchart (1)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 357 of 862 rej09b0429-0100 [3] error processing parity error processing yes no clear orer, per, and fer flags in ssr to 0 no yes no yes framing error processing no yes overrun error processing orer = 1 fer = 1 break? per = 1 clear re bit in scr to 0 figure 13.9 sample serial reception fl owchart (2)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 358 of 862 rej09b0429-0100 13.5 multiprocessor comm unication function use of the multiprocessor communication function en ables data transfer to be performed among a number of processors sharing communication lines by means of asynchronous serial communication using the multiprocessor format, in which a multiprocessor bit is added to the transfer data. when multiprocessor communication is carried out, each receiving station is addressed by a unique id code. the serial communication cycle consists of two component cycles: an id transmission cycle which sp ecifies the receiving station, a nd a data transmission cycle for the specified receiving station. the multiprocessor bit is used to differentiate between the id transmission cycle and the data transmission cycle. if the multiprocessor bit is 1, the cycle is an id transmission cycle, and if the multiprocessor bit is 0, the cycle is a data transmission cycle. figure 13.10 shows an example of inter-processor communication using the multiprocessor format. the transmitting station first sends the id code of the receiving station with which it wants to perform serial communication as data with a 1 multiprocessor bit added. it then sends transmit data as data with a 0 multiprocessor bit added. when data with a 1 multiprocessor bit is received, the receiving station compares that data with its own id. the station whose id matches then receives the data sent next. stations whose id does not match continue to skip data until data with a 1 multiprocessor bit is again received. the sci uses the mpie bit in scr to implement this function. when the mpie bit is set to 1, transfer of receive data from rsr to rdr, error flag detection, and setting the rdrf, fer, and orer status flags in ssr to 1 are prohibited until data with a 1 multiprocessor bit is received. on reception of a receive character with a 1 multiprocessor bit, the mpb bit in ssr is set to 1 and the mpie bit is automatically cleared, thus normal reception is resumed. if the rie bit in scr is set to 1 at this time, an rxi interrupt is generated. when the multiprocessor format is selected, the parity bit setting is invalid. all other bit settings are the same as those in normal asynchronous mode. the clock used for multiprocessor communication is the same as that in normal asynchronous mode.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 359 of 862 rej09b0429-0100 transmitting station receiving station a receiving station b receiving station c receiving station d (id = 01) (id = 02) (id = 03) (id = 04) serial communication line serial data id transmission cycle = receiving station specification data transmission cycle = data transmission to receiving station specified by id (mpb = 1) (mpb = 0) h'01 h'aa [legend] mpb: multiprocessor bit figure 13.10 example of communication using multiprocessor format (transmission of data h'aa to receiving station a)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 360 of 862 rej09b0429-0100 13.5.1 multiprocessor serial data transmission figure 13.11 shows a sample flowchart for multiprocessor serial data transmission. for an id transmission cycle, set the mpbt bit in ssr to 1 before transmission. for a data transmission cycle, clear the mpbt b it in ssr to 0 before transmission. all other sci operations are the same as those in asynchronous mode. no [1] yes initialization start transmission read tdre flag in ssr [2] write transmit data to tdr and set mpbt bit in ssr no yes no yes read tend flag in ssr [3] no yes [4] clear dr to 0 and set ddr to 1 clear te bit in scr to 0 tdre = 1 all data transmitted? tend = 1 break output? clear tdre flag to 0 [1] sci initialization: the txd pin is automatically designated as the transmit data output pin. after the te bit is set to 1, a frame of 1s is output, and transmission is enabled. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr. set the mpbt bit in ssr to 0 or 1. finally, clear the tdre flag to 0. [3] serial transmission continuation procedure: to continue serial transmission, be sure to read 1 from the tdre flag to confirm that writing is possible, then write data to tdr, and then clear the tdre flag to 0. however, the tdre flag is checked and cleared automatically when the dtc is initiated by a transmit data empty interrupt (txi) request and writes data to tdr. [4] break output at the end of serial transmission: to output a break in serial transmission, set port ddr to 1, clear dr to 0, and then clear the te bit in scr to 0. figure 13.11 sample multiprocessor serial transmission flowchart
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 361 of 862 rej09b0429-0100 13.5.2 multiprocessor s erial data reception figure 13.13 shows a sample flowchart for multiprocessor serial data reception. if the mpie bit in scr is set to 1, data is skipped until data with a 1 multiprocessor bit is sent. on receiving data with a 1 multiprocessor bit, the receive data is tr ansferred to rdr. an rxi interrupt request is generated at this time. all other sci operations are the same as in asynchronous mode. figure 13.12 shows an example of sci operation for multiprocessor format reception.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 362 of 862 rej09b0429-0100 mpie rdr value 0d0d1 d71 1 0d0d1 d7 01 1 1 data (id1) start bit mpb stop bit start bit data (data 1) mpb stop bit data (id2) start bit stop bit start bit data (data 2) stop bit rxi interrupt request (multiprocessor interrupt) generated idle state (mark state) rdrf rdr data read and rdrf flag cleared to 0 in rxi interrupt service routine if not this station?s id, mpie bit is set to 1 again rxi interrupt request is not generated, and rdr retains its state id1 (a) data does not match station?s id mpie rdr value 0d0d1 d71 1 0d0d1 d7 01 1 1 mpb mpb rxi interrupt request (multiprocessor interrupt) generated idle state (mark state) rdrf rdr data read and rdrf flag cleared to 0 in rxi interrupt service routine matches this station?s id, so reception continues, and data is received in rxi interrupt service routine mpie bit set to 1 again id2 (b) data matches station?s id data 2 id1 mpie = 0 mpie = 0 figure 13.12 example of sci operation in reception (example with 8-bit data, multiprocessor bit, one stop bit)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 363 of 862 rej09b0429-0100 yes [1] no initialization start reception no yes [4] clear re bit in scr to 0 error processing (continued on next page) [5] no yes fer orer = 1 rdrf = 1 all data received? set mpie bit in scr to 1 [2] read orer and fer flags in ssr read rdrf flag in ssr [3] read receive data in rdr no yes this station?s id? read orer and fer flags in ssr yes no read rdrf flag in ssr no yes fer orer = 1 read receive data in rdr rdrf = 1 [1] sci initialization: the rxd pin is automatically designated as the receive data input pin. [2] id reception cycle: set the mpie bit in scr to 1. [3] sci status check, id reception and comparison: read ssr and check that the rdrf flag is set to 1, then read the receive data in rdr and compare it with this station?s id. if the data is not this station?s id, set the mpie bit to 1 again, and clear the rdrf flag to 0. if the data is this station?s id, clear the rdrf flag to 0. [4] sci status check and data reception: read ssr and check that the rdrf flag is set to 1, then read the data in rdr. [5] receive error processing and break detection: if a receive error occurs, read the orer and fer flags in ssr to identify the error. after performing the appropriate error processing, ensure that the orer and fer flags are all cleared to 0. reception cannot be resumed if either of these flags is set to 1. in the case of a framing error, a break can be detected by reading the rxd pin value. [legend] : logical add (or) figure 13.13 sample multiprocesso r serial reception flowchart (1)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 364 of 862 rej09b0429-0100 error processing yes no clear orer, per, and fer flags in ssr to 0 no yes no yes framing error processing overrun error processing orer = 1 fer = 1 break? clear re bit in scr to 0 [5] figure 13.13 sample multiprocesso r serial reception flowchart (2)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 365 of 862 rej09b0429-0100 13.6 operation in clock synchronous mode figure 13.14 shows the general format for clock synchronous communication. in clock synchronous mode, data is transmitted or received in synchronization with clock pulses. one character in transfer data consists of 8-bit data. in data transmission, the sci outputs data from one falling edge of the synchronization clock to the next. in data reception, the sci receives data in synchronization with the rising edge of the synchr onization clock. after 8-bit data is output, the transmission line holds the msb state. in clock synchronous mode, no parity or multiprocessor bit is added. inside the sci, the transmitter and receiver are independent units, enabling full-duplex communication by use of a common clock. both the transmitter and the receiver also have a double-buffered structure, so that the next transmit data can be written during transmission or the previous receive data can be read during r eception, enabling continuous data transfer. don?t care don?t care one unit of transfer data (character or frame) bit 0 serial data synchronization clock bit 1 bit 3 bit 4 bit 5 lsb msb bit 2 bit 6 bit 7 * * note: * high except in continuous transfer figure 13.14 data format in synchronous communication (lsb-first) 13.6.1 clock either an internal clock generated by the on-chip baud rate generator or an external synchronization clock input at the sck pin can be selected, according to the setting of the cke1 and cke0 bits in scr. when the sci is operated on an internal clock, the synchronization clock is output from the sck pin. eight synchronization clock pulses are output in the transfer of one character, and when no transfer is performed the clock is fixed high.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 366 of 862 rej09b0429-0100 13.6.2 sci initialization (clock synchronous mode) before transmitting and receiving data, you should firs t clear the te and re bits in scr to 0, then initialize the sci as described in a sample flowchart in figure 13.15. when the operating mode, transfer format, etc., is changed, the te and re bits must be cleared to 0 before making the change using the following procedure. when the te b it is cleared to 0, the tdre flag in ssr is set to 1. however, clearing the re bit to 0 does not initialize the rdrf, per, fer, and orer flags in ssr, or rdr. wait start initialization set data transfer format in smr and scmr no yes set value in brr clear te and re bits in scr to 0 [2] [3] set te and re bits in scr to 1, and set rie, tie, teie, and mpie bits [4] 1-bit interval elapsed? set cke1 and cke0 bits in scr (te and re bits are 0) [1] [1] set the clock selection in scr. be sure to clear bits rie, tie, teie, and mpie, te and re to 0. [2] set the data transfer format in smr and scmr. [3] write a value corresponding to the bit rate to brr. this step is not necessary if an external clock is used. [4] wait at least one bit interval, then set the te bit or re bit in scr to 1. also set the rie, tie teie, and mpie bits. setting the te and re bits enables the txd and rxd pins to be used. note: in simultaneous transmit and receive operations, the te and re bits should both be cleared to 0 or set to 1 simultaneously. figure 13.15 sample sci initialization flowchart
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 367 of 862 rej09b0429-0100 13.6.3 serial data transmission (clock synchronous mode) figure 13.16 shows an example of sci operation for transmission in clock synchronous mode. in serial transmission, the sci operates as described below. 1. the sci monitors the tdre flag in ssr, and if it is 0, recognizes that data has been written to tdr, and transfers the data from tdr to tsr. 2. after transferring data from tdr to tsr, the sci sets the tdre flag to 1 and starts transmission. if the tie bit in scr is set to 1 at this time, a txi interrupt request is generated. because the txi interrupt routine writes the next transmit data to tdr before transmission of the current transmit data has finished, continuous transmission can be enabled. 3. 8-bit data is sent from the txd pin synchronized with the output clock when output clock mode has been specified and synchronized with the input clock when use of an external clock has been specified. 4. the sci checks the tdre flag at the timing for sending the last bit. 5. if the tdre flag is cleared to 0, data is tr ansferred from tdr to tsr, and serial transmission of the next frame is started. 6. if the tdre flag is set to 1, the tend flag in ssr is set to 1, and the txd pin maintains the output state of the last bit. if the teie bit in scr is set to 1 at this time, a tei interrupt request is generated. the sck pin is fixed high. figure 13.17 shows a sample flowchart for serial data transmission. even if the tdre flag is cleared to 0, transmission will not start while a receive error flag (orer, fer, or per) is set to 1. make sure to clear the receive error flags to 0 be fore starting transmission. note that clearing the re bit to 0 does not clear the receive error flags.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 368 of 862 rej09b0429-0100 transfer direction bit 0 serial data synchronization clock 1 frame tdre tend data written to tdr and tdre flag cleared to 0 in txi interrupt service routine txi interrupt request generated bit 1 bit 7 bit 0 bit 1 bit 6 bit 7 txi interrupt request generated tei interrupt request generated figure 13.16 sample sci transmission operation in clock synchronous mode
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 369 of 862 rej09b0429-0100 no [1] yes initialization start transmission read tdre flag in ssr [2] write transmit data to tdr and clear tdre flag in ssr to 0 no yes no yes read tend flag in ssr [3] clear te bit in scr to 0 tdre = 1 all data transmitted? tend = 1 [1] sci initialization: the txd pin is automatically designated as the transmit data output pin. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr and clear the tdre flag to 0. [3] serial transmission continuation procedure: to continue serial transmission, be sure to read 1 from the tdre flag to confirm that writing is possible, then write data to tdr, and then clear the tdre flag to 0. however, the tdre flag is checked and cleared automatically when the dtc is initiated by a transmit data empty interrupt (txi) request and writes data to tdr. figure 13.17 sample serial transmission flowchart
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 370 of 862 rej09b0429-0100 13.6.4 serial data reception (clock synchronous mode) figure 13.18 shows an example of sci operation for reception in clock synchronous mode. in serial reception, the sci operates as described below. 1. the sci performs internal initialization in synchronization with a synchronization clock input or output, starts receiving data, and stores the receive data in rsr. 2. if an overrun error (when reception of the next data is completed while the rdrf flag is still set to 1) occurs, the orer bit in ssr is set to 1. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. receive da ta is not transferred to rdr. the rdrf flag remains to be set to 1. 3. if reception finishes successfully, the rdrf b it in ssr is set to 1, and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an rxi interrupt request is generated. because the rxi interrupt routine read s the receive data transferred to rdr before reception of the next receive data has fini shed, continuous reception can be enabled. bit 7 serial data synchronization clock 1 frame rdrf orer eri interrupt request generated by overrun error rxi interrupt request generated rdr data read and rdrf flag cleared to 0 in rxi interrupt service routine rxi interrupt request generated bit 0 bit 7 bit 0 bit 1 bit 6 bit 7 figure 13.18 example of sci receive operation in clock synchronous mode reception cannot be resumed while a receive error fl ag is set to 1. accordingly, clear the orer, fer, per, and rdrf bits to 0 before resuming reception. figure 13.19 shows a sample flowchart for serial data reception.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 371 of 862 rej09b0429-0100 yes [1] no initialization start reception [2] no yes read rdrf flag in ssr [4] [5] clear re bit in scr to 0 error processing (continued below) [3] read receive data in rdr and clear rdrf flag in ssr to 0 no yes orer = 1 rdrf = 1 all data received? read orer flag in ssr error processing overrun error processing clear orer flag in ssr to 0 [3] [1] sci initialization: the rxd pin is automatically designated as the receive data input pin. [2] [3] receive error processing: if a receive error occurs, read the orer flag in ssr, and after performing the appropriate error processing, clear the orer flag to 0. transfer cannot be resumed if the orer flag is set to 1. [4] sci status check and receive data read: read ssr and check that the rdrf flag is set to 1, then read the receive data in rdr and clear the rdrf flag to 0. transition of the rdrf flag from 0 to 1 can also be identified by an rxi interrupt. [5] serial reception continuation procedure: to continue serial reception, before the msb (bit 7) of the current frame is received, reading the rdrf flag, reading rdr, and clearing the rdrf flag to 0 should be finished. however, the rdrf flag is cleared automatically when the dtc is initiated by a receive data full interrupt (rxi) and reads data from rdr. figure 13.19 sample s erial reception flowchart
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 372 of 862 rej09b0429-0100 13.6.5 simultaneous serial data transmission and reception (clock synchronous mode) figure 13.20 shows a sample flowchart for simulta neous serial transmit and receive operations. after initializing the sci, the fo llowing procedure should be used for simultaneous serial data transmit and receive operations. to switch from transmit mode to simultaneous transmit and receive mode, after checking that the sci has finished transmission and the tdre and tend flags in ssr are set to 1, clear the te bit in scr to 0. then simultaneously set the te and re bits to 1 with a single instruction. to switch from receive mode to simultaneous transmit and receive mode, after checking that the sci ha s finished reception, clear the re bit to 0. then after checking that the rdrf bit in ssr and receive error fl ags (orer, fer, and per) are cleared to 0, simultaneously set the te and re bits to 1 with a single instruction.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 373 of 862 rej09b0429-0100 yes [1] no initialization start transmission/reception [5] error processing [3] read receive data in rdr, and clear rdrf flag in ssr to 0 no yes orer = 1 all data received? [2] read tdre flag in ssr no yes tdre = 1 write transmit data to tdr and clear tdre flag in ssr to 0 no yes rdrf = 1 read orer flag in ssr [4] read rdrf flag in ssr clear te and re bits in scr to 0 [1] sci initialization: the txd pin is designated as the transmit data output pin, and the rxd pin is designated as the receive data input pin, enabling simultaneous transmit and receive operations. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr and clear the tdre flag to 0. transition of the tdre flag from 0 to 1 can also be identified by a txi interrupt. [3] receive error processing: if a receive error occurs, read the orer flag in ssr, and after performing the appropriate error processing, clear the orer flag to 0. transmission/reception cannot be resumed if the orer flag is set to 1. [4] sci status check and receive data read: read ssr and check that the rdrf flag is set to 1, then read the receive data in rdr and clear the rdrf flag to 0. transition of the rdrf flag from 0 to 1 can also be identified by an rxi interrupt. [5] serial transmission/reception continuation procedure: to continue serial transmission/ reception, before the msb (bit 7) of the current frame is received, finish reading the rdrf flag, reading rdr, and clearing the rdrf flag to 0. also, before the msb (bit 7) of the current frame is transmitted, read 1 from the tdre flag to confirm that writing is possible. then write data to tdr and clear the tdre flag to 0. however, the tdre flag is checked and cleared automatically when the dtc is initiated by a transmit data empty interrupt (txi) request and writes data to tdr. similarly, the rdrf flag is cleared automatically when the dtc is initiated by a receive data full interrupt (rxi) and reads data from rdr. note: when switching from transmit or receive operation to simultaneous transmit and receive operations, first clear the te bit and re bit to 0, then set both these bits to 1 simultaneously. figure 13.20 sample flowch art of simultaneous serial transmission and reception
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 374 of 862 rej09b0429-0100 13.7 smart card interface description the sci supports the ic card (smart card) interface based on the iso/iec 7816-3 (identification card) standard as an enhanced serial communica tion interface function. smart card interface mode can be selected using the appropriate register. 13.7.1 sample connection figure 13.21 shows a sample connection between the smart card and this lsi. this lsi communicates with the ic card using a single tran smission line. when the smif bit in scmr is set to 1, the txd and rxd pins are interconnected inside the lsi, which makes the rxd pin function as an i/o pin. pull up the data transmission line to vcc using a resistor. setting the re and te bits in scr to 1 with the ic card not connected enables closed transmission/reception allowing self diagnosis. to supply the ic card with the clock pulses generated by the sci, input the sck pin output to the clk pin of the ic card. a reset signal can be supplied via the output port of this lsi. txd rxd this lsi vcc i/o main unit of the device to be connected ic card data line clk rst sck rx (port) clock line reset line figure 13.21 pin connectio n for smart card interface 13.7.2 data format (except in block transfer mode) figure 13.22 shows the data transfer fo rmats in smart card interface mode. ? one frame contains 8-bit data and a parity bit in asynchronous mode. ? during transmission, at least 2 etu (elementary time unit: time required for transferring one bit) is secured as a guard time after the end of the pa rity bit before the start of the next frame. ? if a parity error is detected during reception, a lo w error signal is output for 1 etu after 10.5 etu has passed from the start bit. ? if an error signal is sampled during transmission, the same data is automatically re-transmitted after two or more etu.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 375 of 862 rej09b0429-0100 ds d0 d1 d2 d3 d4 d5 d6 d7 dp in normal transmission/reception output from the transmitting station ds d0 d1 d2 d3 d4 d5 d6 d7 dp when a parity error is generated output from the transmitting station de output from the receiving station [legend] ds: start bit d0 to d7: data bits dp: parity bit de: error signal figure 13.22 data formats in no rmal smart card interface mode for communication with the ic cards of the direct convention and inverse convention types, follow the procedure below. ds azzazz z za a (z) (z) state d0 d1 d2 d3 d4 d5 d6 d7 dp figure 13.23 direct conv ention (sdir = sinv = o/ e = 0) for the direct convention type, logic levels 1 and 0 correspond to states z and a, respectively, and data is transferred with lsb-first as the start char acter, as shown in figure 13.23. therefore, data in the start character in the figure is h'3b. when using the direct convention type, write 0 to both the sdir and sinv bits in scmr. write 0 to the o/ e bit in smr in order to use even parity, which is prescribed by the smart card standard. ds azzaaa z aa a (z) (z) state d7 d6 d5 d4 d3 d2 d1 d0 dp figure 13.24 inverse convention (sdir = sinv = o/ e = 1)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 376 of 862 rej09b0429-0100 for the inverse convention type, logic levels 1 and 0 correspond to states a and z, respectively and data is transferred with msb-first as the star t character, as shown in figure 13.24. therefore, data in the start character in the figure is h'3f. when using the inverse convention type, write 1 to both the sdir and sinv bits in scmr. the parity bit is logic level 0 to produce even parity, which is prescribed by the smart card standard, and corresponds to state z. since the sinv bit of this lsi only inverts data bits d7 to d0, write 1 to the o/ e bit in smr to invert the parity bit in both transmission and reception. 13.7.3 block transfer mode block transfer mode is different from normal sm art card interface mode in the following respects. ? if a parity error is detected during reception, no error signal is output. since the per bit in ssr is set by error detection, clear the bit befo re receiving the parity bit of the next frame. ? during transmission, at least 1 etu is secured as a guard time after the end of the parity bit before the start of the next frame. ? since the same data is not re-transmitted during transmission, the tend flag in ssr is set 11.5 etu after transmission start. ? although the ers flag in block transfer mode displays the error signal status as in normal smart card interface mode, the flag is always read as 0 because no error signal is transferred.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 377 of 862 rej09b0429-0100 13.7.4 receive data sampling ti ming and reception margin only the internal clock generated by the internal baud rate generator can be used as a communication clock in smart card interface mode . in this mode, the sci can operate using a basic clock with a frequency of 32, 64, 372, or 256 times the bit rate according to the bcp1 and bcp0 settings (the frequency is always 16 times the bit rate in normal asynchronous mode). at reception, the falling edge of the start bit is sampled using the internal basic clock in order to perform internal synchronization. receive data is sampled at the 16th, 32nd, 186th and 128th rising edges of the basic clock pulses so that it can be latched at the center of each bit as shown in figure 13.25. the reception margin here is determined by the following formula. m = ? (0.5 ? ) ? (l ? 0.5) f ? (1 + f) ? 100 [%] ... formula (1) 2n 1 n ? d ? 0.5 ? m: n: d: l: f: reception margin (%) ratio of bit rate to clock (n = 32, 64, 372, 256) clock duty (d = 0 to 1.0) frame length (l = 10) absolute value of clock rate deviation assuming values of f = 0, d = 0.5, and n = 372 in formula (1), the reception margin is determined by the formula below. m = (0.5 ? 1/2 x 372) x 100 [%] = 49.866%
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 378 of 862 rej09b0429-0100 internal basic clock 372 clock cycles 186 clock cycles receive data (rxd) synchronization sampling timing d0 d1 data sampling timing 185 371 0 371 185 0 0 start bit figure 13.25 receive data sampling ti ming in smart card interface mode (when clock frequency is 372 times the bit rate) 13.7.5 initialization before starting transmitting and receiving data, initialize the sci using the following procedure. initialization is also necessary before switching from transmission to reception and vice versa. 1. clear the te and re bits in scr to 0. 2. clear the error flags orer, ers, and per in ssr to 0. 3. set the gm, blk, o/ e , bcp1, bcp0, cks1, and cks0 bits in smr appropriately. also set the pe bit to 1. 4. set the smif, sdir, and sinv bits in scmr appropriately. when the smif bit is set to 1, the txd and rxd pins are changed from port pins to sci pins, placing the pins into high impedance state. 5. set the value corresponding to the bit rate in brr. 6. set the cke1 and cke0 bits in scr appropriately. clear the tie, rie, te, re, mpie, and teie bits to 0 simultaneously. when the cke0 bit is set to 1, the sck pin is allowed to output clock pulses. 7. set the tie, rie, te, and re bits in scr appr opriately after waiting for at least 1 bit interval. setting prohibited the te and re bits to 1 simultaneously except for self diagnosis.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 379 of 862 rej09b0429-0100 to switch from reception to transmission, first veri fy that reception has completed, and initialize the sci. at the end of initialization, re and te should be set to 0 and 1, respectively. reception completion can be verified by reading the rdrf flag or per and orer flags. to switch from transmission to reception, first verify that tran smission has completed, and initialize the sci. at the end of initialization, te and re should be set to 0 and 1, respectively. transmission completion can be verified by reading the tend flag. 13.7.6 serial data transmission (except in block transfer mode) data transmission in smart card interface mode (ex cept in block transfer mode) is different from that in normal serial communicati on interface mode in that an error signal is sampled and data is re-transmitted. figure 13.26 shows the data re-transfer operation during transmission. 1. if an error signal from the receiving end is sampled after one frame of data has been transmitted, the ers bit in ssr is set to 1. here , an eri interrupt request is generated if the rie bit in scr is set to 1. clear the ers bit to 0 before the next parity bit is sampled. 2. for the frame in which an error signal is receive d, the tend bit in ssr is not set to 1. data is re-transferred from tdr to tsr allowing automatic data retransmission. 3. if no error signal is returned from the receiving en d, the ers bit in ssr is not set to 1. in this case, one frame of data is determined to have been transmitted including re-transfer, and the tend bit in ssr is set to 1. here, a txi interrupt request is generated if the tie bit in scr is set to 1. writing transmit data to tdr starts transmission of the next data. figure 13.28 shows a sample flowchart for transmission. all the processing steps are automatically performed using a txi interrupt request to activate the dtc. in transmission, the tend and tdre flags in ssr are simultaneously set to 1, thus generating a txi interrupt request when tie in scr is set. this activates the dtc by a txi request thus allowing transfer of transmit data if the txi interrupt request is specified as a source of dtc activation beforehand. the tdre and tend flags are automa tically cleared to 0 at data tr ansfer by the dtc. if an error occurs, the sci automatically re-transmits the same data. during re-transmission, tend remains as 0, thus not activating the dtc. therefore, the sci and dtc automatically transmit the specified number of bytes, including re-transmission in the case of error occurrence. however, the ers flag is not automatically cl eared; the ers flag must be clear ed by previously setting the rie bit to 1 to enable an eri interrupt request to be generated at error occurrence. when transmitting/receiving data using the dtc, be sure to set and enable it prior to making sci settings. see section 7, data transfer controller (dtc) for dtc settings.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 380 of 862 rej09b0429-0100 d0 d1 d2 d3 d4 d5 d6 d7 dp de ds d0 d1 d2 d3 d4 d5 d6 d7 dp (de) ds d0 d1 d2 d3 d4 ds (n + 1) th transfer frame retransfer frame nth transfer frame tdre tend [1] fer/ers transfer from tdr to tsr transfer from tdr to tsr transfer from tdr to tsr [2] [3] [3] figure 13.26 data re-transfer operation in sci transmission mode note that the tend flag is set in different timings depending on the gm bit setting in smr, which is shown in figure 13.27. ds d0 d1 d2 d3 d4 d5 d6 d7 dp i/o data 12.5 etu txi (tend interrupt) 11.0 etu de guard time gm = 0 gm = 1 [legend] ds: d0 to d7: dp: de: etu: start bit data bits parity bit error signal element time unit (time taken to transfer one bit) figure 13.27 tend flag set timings during transmission
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 381 of 862 rej09b0429-0100 initialization no yes clear te bit in scr to 0 start transmission start no no no yes yes yes yes no end write data to tdr and clear tdre flag in ssr to 0 error processing error processing tend = 1 ? all data transmitted? tend = 1 ? ers = 0 ? ers = 0 ? figure 13.28 sample transmission flowchart
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 382 of 862 rej09b0429-0100 13.7.7 serial data r eception (except in block transfer mode) data reception in smart card interface mode is iden tical to that in norm al serial communication interface mode. figure 13.29 shows the data re-transfer operation during reception. 1. if a parity error is detected in receive data , the per bit in ssr is set to 1. here, an eri interrupt request is generated if the rie bit in scr is set to 1. clear the per bit to 0 before the next parity bit is sampled. 2. for the frame in which a parity error is detected, the rdrf bit in ssr is not set to 1. 3. if no parity error is detected, the per bit in ssr is not set to 1. in this case, data is determined to have been received successfully, and the rdrf b it in ssr is set to 1. here, an rxi interrupt request is generated if the rie bit in scr is set. figure 13.30 shows a sample flowchart for receptio n. all the processing st eps are automatically performed using an rxi interrupt request to activate the dtc. in reception, setting the rie bit to 1 allows an rxi interrupt request to be generated when the rdrf flag is set to 1. this activates dtc by an rxi request thus allowing transfer of receive data if the rxi interrupt request is specified as a source of dtc activate beforehand. th e rdrf flag is automati cally cleared to 0 at data transfer by dtc. if an error occurs during r eception, i.e., either the orer or per flag is set to 1, a transmit/receive error interrupt (eri) requ est is generated and the error flag must be cleared. if an error occurs, dtc is not activated a nd receive data is skipped, therefore, the number of bytes of receive data specified in dtc are transf erred. even if a parity error occurs and per is set to 1 in reception, receive data is transferred to rdr, thus allowing the data to be read. note: for operations in block transfer mode, s ee section 13.4, operation in asynchronous mode. d0 d1 d2 d3 d4 d5 d6 d7 dp de ds d0 d1 d2 d3 d4 d5 d6 d7 dp (de) ds d0 d1 d2 d3 d4 ds (n + 1) th transfer frame retransfer frame n th transfer frame rdrf [1] per [2] [3] [3] figure 13.29 data re-transfer op eration in sci reception mode
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 383 of 862 rej09b0429-0100 initialization read data from rdr and clear rdrf flag in ssr to 0 clear re bit in scr to 0 start reception start error processing no no no yes yes orer = 0 and per = 0? rdrf = 1 ? all data received? yes figure 13.30 sample reception flowchart
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 384 of 862 rej09b0429-0100 13.7.8 clock output control clock output can be fixed using the cke1 and cke0 bits in scr when the gm bit in smr is set to 1. specifically, the minimum width of a clock pulse can be specified. figure 13.31 shows an example of clock output fixing timing when the cke0 bit is controlled with gm = 1 and cke1 = 0. specified pulse width sck cke0 specified pulse width figure 13.31 clock output fixing timing at power-on and transitions to/from software standby mode, use the following procedure to secure the appropriate clock duty ratio. at power-on: to secure the appropriate clock duty ratio simultaneously with power-on, use the following procedure. 1. initially, port input is enabled in the high-impedance state. to fix the potential level, use a pull-up or pull-down resistor. 2. fix the sck pin to the specified output using the cke1 bit in scr. 3. set smr and scmr to enab le smart card interface mode. 4. set the cke0 bit in scr to 1 to start clock output.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 385 of 862 rej09b0429-0100 at transition from smart card interface mode to software standby mode: 1. set the port data register (dr) and data direction register (ddr) corresponding to the sck pins to the values for the output fixed state in software standby mode. 2. write 0 to the te and re bits in scr to stop transmission/reception. simultaneously, set the cke1 bit to the value for the output fixed state in software standby mode. 3. write 0 to the cke0 bit in scr to stop the clock. 4. wait for one cycle of the serial clock. in the mean time, the clock output is fixed to the specified level with the duty ratio retained. 5. make the transition to software standby mode. at transition from software standby mode to smart card interface mode: 1. cancel software standby mode. 2. write 1 to the cke0 bit in scr to start clock output. a clock signal with the appropriate duty ratio is then generated. [1] [2] [3] [4] [5] [2] software standby normal operation normal operation [1] figure 13.32 clock stop and restart procedure
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 386 of 862 rej09b0429-0100 13.8 interrupt sources 13.8.1 interrupts in normal serial communication interface mode table 13.12 shows the interrupt sources in no rmal serial communication interface mode. a different interrupt vector is assigned to each interrupt source, and individual interrupt sources can be enabled or disabled using the enable bits in scr. when the tdre flag in ssr is set to 1, a txi interrupt request is generated. when the tend flag in ssr is set to 1, a tei interrupt request is generated. a txi interrupt can activate the dtc to allow data transfer. the tdre flag is automatica lly cleared to 0 at data transfer by the dtc. when the rdrf flag in ssr is set to 1, an rxi interrupt request is generated. when the orer, per, or fer flag in ssr is set to 1, an eri interrupt request is generated. an rxi interrupt can activate the dtc to allow data transfer. the rdrf flag is automatically cleared to 0 at data transfer by the dtc. a tei interrupt is requested when the tend flag is set to 1 while the teie bit is set to 1. if a tei interrupt and a txi interrupt are requested simultaneously, the txi interrupt has priority for acceptance. however, note that if the tdre a nd tend flags are cleared simultaneously by the txi interrupt routine, the sci cannot branch to the tei interrupt routine later. table 13.12 sci interrupt sources channel name interrupt source inte rrupt flag dtc activation priority eri1 receive error orer, fer, per not possible high rxi1 receive data full rdrf possible txi1 transmit data empty tdre possible 1 tei1 transmit end tend not possible eri3 receive error orer, fer, per not possible rxi3 receive data full rdrf possible txi3 transmit data empty tdre possible 3 tei3 transmit end tend not possible low
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 387 of 862 rej09b0429-0100 13.8.2 interrupts in smart card interface mode table 13.13 shows the interrupt sources in smar t card interface mode. a tei interrupt request cannot be used in this mode. table 13.13 sci interrupt sources channel name interrupt source inte rrupt flag dtc activation priority eri1 receive error, error signal detection orer, per, ers not possible high rxi1 receive data full rdrf possible 1 txi1 transmit data empty tend possible eri3 receive error, error signal detection orer, per, ers not possible rxi3 receive data full rdrf possible 3 txi3 transmit data empty tend possible low data transmission/reception using the dtc is also possible in smart card interface mode, similar to in the normal sci mode. in transmission, the tend and tdre flags in ssr are simultaneously set to 1, thus generating a txi interrupt request. this activates the dtc by a txi interrupt request thus allowing transfer of transmit data if the txi interrupt request is specified as a source of dtc activation beforehand. the tdre and tend flags are automatically cleared to 0 at data transfer by the dtc. if an error occurs, the sci automatically re-transmits the same data. during re- transmission, the tend flag remains as 0, thus not activating the dtc. therefore, the sci and dtc automatically transmit the specified number of bytes, including re-transmission in the case of error occurrence. however, the ers flag in ssr , which is set at error occurrence, is not automatically cleared ; the ers flag must be cleared by previously setting the rie bit in scr to 1 to enable an eri interrupt request to be generated at error occurrence. when transmitting/receiving data using the dtc, be sure to set and enable the dtc prior to making sci settings. for dtc settings, see section 7, data transfer controller (dtc). in reception, an rxi interrupt request is generated when the rdrf flag in ssr is set to 1. this activates the dtc by an rxi interrupt request thus allowing transfer of receive data if the rxi interrupt request is specified as a source of dtc activation beforehand. the rdrf flag is automatically cleared to 0 at data transfer by the dtc. if an er ror occurs, the rdrf flag is not set but the error flag is set. therefore, the dtc is not activated and an eri interrupt request is issued to the cpu instead; the erro r flag must be cleared.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 388 of 862 rej09b0429-0100 13.9 usage notes 13.9.1 module stop mode setting sci operation can be disabled or enabled using the module stop control register. the initial setting is for sci operation to be halted. register acce ss is enabled by clearing module stop mode. for details, see section 24, power-down modes. 13.9.2 break detectio n and processing when framing error detection is performed, a break can be detected by reading the rxd pin value directly. in a break, the input from the rxd pin becomes all 0s, and so the fer flag in ssr is set, and the per flag may also be set. note that, since the sci continues the receive operation even after receiving a break, even if the fer flag is cleared to 0, it will be set to 1 again. 13.9.3 mark state and break sending when the te bit in scr is 0, the txd pin is used as an i/o port whose direction (input or output) and level are determined by dr and ddr of the port. this can be used to set the txd pin to mark state (high level) or send a break during serial data transmission. to maintain the communication line at mark state until te is set to 1, set both ddr a nd dr to 1. since the te bit is cleared to 0 at this point, the txd pin becomes an i/o port, and 1 is output from the txd pin. to send a break during serial transmission, first set ddr to 1 and dr to 0, and then clear the te bit to 0. when the te bit is cleared to 0, the transmitter is initialized regardless of the current transmission state, the txd pin becomes an i/o port, and 0 is output from the txd pin. 13.9.4 receive error flags and transmit op erations (clock sync hronous mode only) transmission cannot be started when a receive error fl ag (orer, fer, or rer) in ssr is set to 1, even if the tdre flag in ssr is cleared to 0. be sure to clear th e receive error flags to 0 before starting transmission. note also that the receive er ror flags cannot be cleared to 0 even if the re bit in scr is cleared to 0. 13.9.5 relation between writing to tdr and tdre flag data can be written to tdr irrespective of the tdre flag status in ssr. however, if the new data is written to tdr when the tdre flag is 0, that is, when the previous data has not been transferred to tsr yet, the previous data in tdr is lost. be sure to write transmit data to tdr after verifying that the tdre flag is set to 1.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 389 of 862 rej09b0429-0100 13.9.6 restrictions on using dtc when the external clock source is used as a synchronization clock, update tdr by the dtc and wait for at least five clock cycles before allowing the transmit clock to be input. if the transmit clock is input within four clock cycles after tdr modification, the sci may malfunction (figure 13.33). when using the dtc to read rdr, be sure to se t the receive end interrupt source (rxi) as a dtc activation source. t d0 lsb serial data sck d1 d3 d4 d5 d2 d6 d7 note: when external clock is supplied, t must be more than four clock cycles. tdre figure 13.33 sample transmission using dtc in clock synchronous mode
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 390 of 862 rej09b0429-0100 13.9.7 sci operations during mode transitions transmission: before making the transition to module stop or software standby mode, stop all transmit operations (te = tie = teie = 0). tsr, tdr, and ssr are reset. the states of the output pins during each mode depend on the port settings, and the pins output a high-level signal after mode cancellation. if the transition is made during data transmission, the data being transmitted will be undefined. to transmit data in the same transmission mode after mode cancellation, set te to 1, read ssr, write to tdr, clear tdre in this order, and then start transmission. to transmit data in a different transmission mode, initialize the sci first. figure 13.34 shows a sample flowchart for mode transition during transmission. figures 13.35 and 13.36 show the pin states during transmission. before making the transition from the transmission mode using dtc transfer to module stop or software standby mode, stop all transmit operations (te = tie = teie = 0). setting te and tie to 1 after mode cancellation generates a txi interrupt request to start transmission using the dtc.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 391 of 862 rej09b0429-0100 start transmission transmission [1] no no no yes yes yes read tend flag in ssr make transition to software standby mode etc. cancel software standby mode etc. te = 0 initialization te = 1 [2] [3] all data transmitted? change operating mode? tend = 1 [1] data being transmitted is lost halfway. data can be normally transmitted from the cpu by setting te to 1, reading ssr, writing to tdr, and clearing tdre to 0 after mode cancellation; however, if the dtc has been initiated, the data remaining in dtc ram will be transmitted when te and tie are set to 1. [2] also clear tie and teie to 0 when they are 1. [3] module stop mode is included. figure 13.34 sample flowchart for mode transition during transmission te bit sck output pin txd output pin port input/output port input/output port input/output start stop high output high output transmission start transmission end transition to software standby mode software standby mode cancelled sci txd output port port sci txd output figure 13.35 pin states during transmission in asynchronous mode (internal clock)
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 392 of 862 rej09b0429-0100 te bit sck output pin txd output pin port input/output port input/output port input/output high output * marking output transmission start transmission end transition to software standby mode software standby mode cancelled sci txd output port port sci txd output last txd bit retained note: initialized in software standby mode figure 13.36 pin states during transmission in clock synchronous mode (internal clock) reception: before making the transition to module st op or software standby mode, stop reception (re = 0). rsr, rdr, and ssr are reset. if trans ition is made during data reception, the data being received will be invalid. to receive data in the same reception mode after mode cancellation, set re to 1, and then start reception. to receive data in a differen t reception mode, initialize the sci first. figure 13.37 shows a sample flowchart for mode transition during reception.
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 393 of 862 rej09b0429-0100 start reception reception [1] no no yes yes read receive data in rdr read rdrf flag in ssr make transition to software standby mode etc. cancel software standby mode etc. re = 0 initialization re = 1 [2] change operating mode? rdrf = 1 [1] data being received will be invalid. [2] module stop mode is included. figure 13.37 sample fl owchart for mode transi tion during reception
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 394 of 862 rej09b0429-0100 13.9.8 notes on switching from sck pins to port pins when sck pins are switched to port pins after transmission has completed, pins are enabled for port output after outputting a low pulse of half a cycle as shown in figure 13.38. sck/port cke0 cke1 c/ a te data 1. transmission end 2. te = 0 3. c/ a = 0 4. low pulse output bit 6 bit 7 low pulse of half a cycle figure 13.38 switching from sck pins to port pins to prevent the low pulse output that is generated when switching the sck pins to the port pins, specify the sck pins for input (pull up the sck/port pins externally), and follow the procedure below with ddr = 1, dr = 1, c/ a = 1, cke1 = 0, cke1 = 0, and te = 1. 1. end serial data transmission 2. te bit = 0 3. cke1 bit = 1 4. c/ a bit = 0 (switch to port output) 5. cke1 bit = 0
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 395 of 862 rej09b0429-0100 sck/port cke0 cke1 c/ a te data 1. transmission end 2. te = 0 4. c/ a = 0 3. cke1 = 1 5. cke1 = 0 bit 6 bit 7 high output figure 13.39 prevention of low pulse output at switching from sck pins to port pins
section 13 serial communication interface (sci) rev. 1.00 mar. 17, 2008 page 396 of 862 rej09b0429-0100
section 14 crc operation circuit (crc) rev. 1.00 mar. 17, 2008 page 397 of 862 rej09b0429-0100 section 14 crc operation circuit (crc) this lsi has a cyclic redundancy check (crc) operation circuit to enhance the reliability of data transfer in high-speed communications, etc. th e crc operation circuit detects errors in data blocks. 14.1 features the features of the crc operation circuit are listed below. ? crc code generated for any desired data length in an 8-bit unit ? crc operation executed on eight bits in parallel ? one of three generating polynomials selectable ? crc code generation for lsb-first or msb-first communication selectable figure 14.1 is a block diagram of the crc operation circuit. internal bus crc code generation circuit crccr crcdir crcdor control signal [legend] crccr: crcdir: crcdor: crc control register crc data input register crc data output register figure 14.1 block diagram of crc operation circuit
section 14 crc operation circuit (crc) rev. 1.00 mar. 17, 2008 page 398 of 862 rej09b0429-0100 14.2 register descriptions the crc operation circuit has the following registers. ? crc control register (crccr) ? crc data input register (crcdir) ? crc data output register (crcdor) 14.2.1 crc control register (crccr) crccr initializes the crc operation circuit, switches the operation mode, and selects the generating polynomial. bit bit name initial value r/w description 7 dorclr 0 w crcdor clear setting this bit to 1 clears crcdor to h 0000. 6 to 3 ? all 0 r reserved the initial value should not be changed. 2 lms 0 r/w crc operation switch selects crc code generation for lsb-first or msb-first communication. 0: performs crc operation for lsb-first communication. the lower byte (bits 7 to 0) is first transmitted when crcdor contents (crc code) are divided into two bytes to be transmitted in two parts. 1: performs crc operation for msb-first communication. the upper byte (bits 15 to 8) is first transmitted when crcdor contents (crc code) are divided into two bytes to be transmitted in two parts. 1 0 g1 g0 0 0 r/w r/w crc generating polynomial select these bits select the polynomial. 00: reserved 01: x 8 + x 2 + x + 1 10: x 16 + x 15 + x 2 + 1 11: x 16 + x 12 + x 5 + 1
section 14 crc operation circuit (crc) rev. 1.00 mar. 17, 2008 page 399 of 862 rej09b0429-0100 14.2.2 crc data input register (crcdir) crcdir is an 8-bit readable/writable register, to which the bytes to be crc-operated are written. the result is obtained in crcdor. 14.2.3 crc data output register (crcdor) crcdor is a 16-bit readable/writable register th at contains the result of crc operation when the bytes to be crc-operated are written to crcd ir after crcdor is cleared. when the crc operation result is additionally written to the bytes to which crc operation is to be performed, the crc operation result will be h'0000 if the data c ontains no crc error. when bits 1 and 0 in crccr are set to g1 = 0 and g0 = 1, respectively, the lower byte of this register contains the result. 14.3 crc operation ci rcuit operation the crc operation circuit generates a crc code for lsb-first/msb-first communications. an example in which a crc code for hexadecimal data h'f0 is generated using the x 16 + x 12 + x 5 + 1 polynomial with the g1 and g0 bits in crccr set to b'11 is shown below. crccr crcdorh crcdorl crcdor clearing 1. write h'83 to crccr 1 7 0 0 0 00 0 7 0 7 0 7 0 1 1 0 0 0 0 0 00 0 0 0 0 0 0 00 0 crcdir crcdorh crcdorl crc code generation 2. write h'f0 to crcdir 1 1 1 1 0 00 0 1 1 1 1 0 11 1 1 0 0 0 1 11 1 crc code = h'f78f crc code output data 3. read from crcdor 7 7 7 fff0 8 7 00 0 4. serial transmission (lsb first) 1 1 1 1 0 1 1 1 1 0 0 0 1 11 1 1 1 1 1 0 00 0 figure 14.2 lsb-first data transmission
section 14 crc operation circuit (crc) rev. 1.00 mar. 17, 2008 page 400 of 862 rej09b0429-0100 crccr crcdorh crcdorl crcdor clearing 1. write h'87 to crccr 1 7 0 0 0 01 0 7 0 7 0 7 0 1 1 0 0 0 0 0 00 0 0 0 0 0 0 00 0 crcdir crcdorh crcdorl crc code generation 2. write h'f0 to crcdir 1 1 1 1 0 00 0 1 1 1 0 1 11 1 0 0 0 1 1 11 1 crc code = h'ef1f crc code output data 3. read from crcdor 7 7 0 ff1f e 7 00 0 4. serial transmission (msb first) 1 1 1 1 0 0 0 0 1 1 1 0 1 11 1 0 0 0 1 1 11 1 figure 14.3 msb-first data transmission
section 14 crc operation circuit (crc) rev. 1.00 mar. 17, 2008 page 401 of 862 rej09b0429-0100 crccr crcdorh crcdorl crcdor clearing 2. write h'83 to crccr 1 7 0 0 0 00 0 7 0 7 0 7 0 1 1 0 0 0 0 0 00 0 0 0 0 0 0 00 0 crcdir crcdorh crcdorl crc code generation 3. write h'f0 to crcdir 1 1 1 1 0 00 0 1 1 1 1 0 11 1 1 0 0 0 1 11 1 crcdir crcdorh crcdorl crc code generation 4. write h'8f to crcdir 1 7 0 0 0 11 0 7 0 7 0 7 0 1 1 0 0 0 0 0 00 0 1 1 1 1 0 11 1 crcdir crcdorh crcdorl crc code generation 5. write h'f7 to crcdir 1 1 1 1 0 11 1 0 0 0 0 0 00 0 0 0 0 0 0 00 0 crc code = h'0000 no error crc code input data 6. read from crcdor 7 7 7 fff0 8 7 00 0 1. serial reception (lsb first) 1 1 1 1 0 1 1 1 1 0 0 0 1 11 1 1 1 1 1 0 00 0 figure 14.4 lsb-fi rst data reception
section 14 crc operation circuit (crc) rev. 1.00 mar. 17, 2008 page 402 of 862 rej09b0429-0100 crccr crcdorh crcdorl crcdor clearing 2. write h'87 to crccr 1 7 0 0 0 01 0 7 0 7 0 7 0 1 1 0 0 0 0 0 00 0 0 0 0 0 0 00 0 crcdir crcdorh crcdorl crc code generation 3. write h'f0 to crcdir 1 1 1 1 0 00 0 1 1 1 0 1 11 1 0 0 0 1 1 11 1 crcdir crcdorh crcdorl crc code generation 4. write h'ef to crcdir 1 7 1 1 0 11 0 7 0 7 0 7 0 1 1 0 0 0 1 1 11 1 0 0 0 0 0 00 0 crcdir crcdorh crcdorl crc code generation 5. write h'1f to crcdir 0 0 0 1 1 11 1 0 0 0 0 0 00 0 0 0 0 0 0 00 0 crc code = h'0000 no error crc code input data 6. read from crcdor 7 7 0 ff1f e 7 00 0 1. serial reception (msb first) 1 1 1 1 0 0 0 0 1 1 1 0 1 11 1 0 0 0 1 1 11 1 figure 14.5 msb-fi rst data reception
section 14 crc operation circuit (crc) rev. 1.00 mar. 17, 2008 page 403 of 862 rej09b0429-0100 14.4 note on crc op eration circuit note that the sequence to transmit the crc c ode differs between lsb-first transmission and msb-first transmission. crcdir crcdorh crcdorl 1. crc code generation 2. transmission data (i) lsb-first transmission crc code generation after specifying the operation method, write data to crcdir in the sequence of (1) (2) (3) (4). crc code output 7 7 70 0 0 0 70 00 0 777 7 (1) (2) (3) (4) (5) (6) (1) (2) (3) (4) (6) (5) (ii) msb-first transmission crc code output 77 000000 777 7 (6) (5) (4) (3) (2) (1) figure 14.6 lsb-first and msb-first transmit data
section 14 crc operation circuit (crc) rev. 1.00 mar. 17, 2008 page 404 of 862 rej09b0429-0100
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 405 of 862 rej09b0429-0100 section 15 serial communi cation interface with fifo (scif) this lsi has single-channel serial communicati on interface with fifo buffers (scif) that supports asynchronous serial communication. the scif enables asynchronous serial co mmunication with standard asynchronous communication lsis such as a universal asynchronous receiver/transmitter (uart). the scif also has independent 16-stage fifo buffers fo r transmission and receptio n to provide efficient high-speed continuous communication. in addition, the scif can be connected to the lpc interface fo r direct control from the lpc host. 15.1 features ? full-duplex communication: the transmitter and receiver are independent, en abling transmission and reception to be executed simultaneously. both the transmitter and receiver us e 16-stage fifo buffering, enabling continuous transmission and continuous reception of serial data. ? on-chip baud rate generator allows any bit rate to be selected ? modem control function (only for cts and rts ) ? data length: selectable from 5, 6, 7, and 8 bits ? parity: selectable from even parity, odd parity, and no parity ? stop bit length: selectable from 1, 1.5, and 2 bits ? receive error detection: parity , overrun, and framing errors ? break detection
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 406 of 862 rej09b0429-0100 figure 15.1 shows a block diagram of the scif. lpc interface internal data bus bus interface modem controller p64/ cts p65/ rts p50/txdf p51/rxdf frsr ftsr fthr frbr transmit fifo (16 bytes) transmission (1 byte) clock selection/ divider circuit sclk fdlh fdll baud rate generator transfer clock scifcr fier fiir ffcr flcr fmcr flsr fmsr fscr register transmission/ reception control scif interrupt request system clock lclk receive fifo (16 bytes) reception (1 byte) [legend] frsr: receive shift register ftsr: transmitter shift register frbr: receive buffer register fthr: transmitter holding register fdlh, fdll: divisor latch h, l fier: interrupt enable register fiir: interrupt identification register ffcr: fifo control register flcr: line control register fmcr: modem control register flsr: line status register fmsr: modem status register fscr: scratch pad register scifcr: scif control register figure 15.1 block diagram of scif
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 407 of 862 rej09b0429-0100 15.2 input/output pins table 15.1 lists the scif input/output pins. table 15.1 pin configuration pin name port input/output function txdf p50 output transmit data output rxdf p51 input re ceive data input cts p64 input transmission permission input rts p65 output transmission request output
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 408 of 862 rej09b0429-0100 15.3 register descriptions the scif has the following registers. the register configuration of the scif is shown below. access to the registers is switched by the sc ife bit in hicr5 and bit 3 in submstpbl. for details, see table 15.2. for the scif address registers h and l (scifadrh, scifadrl) and serirq control register 4 (sirqcr4), see section 18, lpc interface (lpc). ? host interface control register 5 (hicr5) ? receive buffer register (frbr) ? transmitter holding register (fthr) ? divisor latch l (fdll) ? interrupt enable register (fier) ? divisor latch h (fdlh) ? interrupt identification register (fiir) ? fifo control register (ffcr) ? line control register (flcr) ? modem control register (fmcr) ? line status register (flsr) ? modem status register (fmsr) ? scratch pad register (fscr) ? scif control register (scifcr) ? scif address register h (scifadrh) ? scif address register l (scifadrl) ? serirq control register 4 (sirqcr4) table 15.2 register access scife bit in hicr5 0 1 bit 3 in submstpbl 0 1 0 1 scifcr h8s cpu access * 2 access disabled h8s cpu access * 2 access disabled other than scifcr h8s cpu access * 2 access disabled lpc access * 1 lpc access * 1 notes: 1. when lpc access is set, writing from t he h8s cpu is disabled. the read value is h'ff. 2. when h8s cpu access is set, writing from the lpc is disabled. the read value is h'00.
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 409 of 862 rej09b0429-0100 15.3.1 receive shift register (frsr) frsr is a register that receives data and converts serial data input from the rxdf pin to parallel data. it stores the data in the order received from the lsb (bit 0). when one frame of serial data has been received, the data is transferred to frbr. frsr cannot be read from the cpu/lpc interface. 15.3.2 receive buffer register (frbr) frbr is an 8-bit read-only register that stores received serial data. it can read data correctly when the dr bit in flsr is set. when the fifo is disabled, the data in frbr must be read before the next data is received. if new data is received before the remaining data is read , the data is overwritten , resulting in an overrun error. when this register is read with the fifo enable d, the first buffer of the receive fifo is read. when the receive fifo becomes full, the subsequent receive data is lost, resulting in an overrun error. bit bit name initial value r/w description 7 to 0 bit 7 to bit 0 all 0 r stores received serial data. the data is 16 bytes when the fifo is enabled. 15.3.3 transmitter shift register (ftsr) ftsr is a register that converts parallel data from the txdf pin to serial data and then transmits the serial data. when one frame transmission of serial data is completed, the next data is transferred from fthr. the serial data is transmitted from the lsb (bit 0). ftsr cannot be written from the h8s cpu/ lpc interface.
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 410 of 862 rej09b0429-0100 15.3.4 transmitter holding register (fthr) fthr is an 8-bit write-only register that stores serial transmit data. it is accessible when the dlab bit in flcr is 0. write transmit data while the thre bit in flcr is set to 1. data can be written to fthr when the thre bit is se t with the fifo disabled. if data is written to fthr when the thre bit is not set, the data is overwritten. while the thre bit is set with the fifo enabled, up to 16 bytes of data can be written. if data is written with the fifo full, the written data is lost. bit bit name initial value r/w description 7 to 0 bit 7 to bit 0 ? w stores serial data to be transmitted. the data is 16 bytes when the fifo is enabled. 15.3.5 divisor latch h, l (fdlh, fdll) the fdlh and fdll are registers used to set th e baud rate. they are accessible when the dlab bit in flcr is 1. frequency division ranging from 1 to (2 16 ? 1) can be set with these registers. the frequency divider circuit stops when both of fdlh and fdll are 0 (initial value). ? fdlh bit bit name initial value r/w description 7 to 0 bit 7 to bit 0 all 0 r/w upper 8 bits of divisor latch ? fdll bit bit name initial value r/w description 7 to 0 bit 7 to bit 0 all 0 r/w lower 8 bits of divisor latch baud rate = (clock frequency input to baud rate generator) / (16 divisor value)
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 411 of 862 rej09b0429-0100 15.3.6 interrupt enab le register (fier) fier is a register that enables or disables inte rrupts. it is accessible wh en the dlab bit in flcr is 0. bit bit name initial value r/w description 7 to 4 ? all 0 r reserved these bits are always read as 0. the initial value should not be changed. 3 edssi 0 r/w modem status interrupt enable 0: modem status interrupt disabled 1: modem status interrupt enabled 2 elsi 0 r/w receive line status interrupt enable 0: receive line status interrupt disabled 1: receive line status interrupt enabled 1 etbei 0 r/w fthr empty interrupt enable 0: fthr empty interrupt disabled 1: fthr empty interrupt enabled 0 erbfi 0 r/w receive data ready interrupt enable a character timeout interrupt is included when the fifo is enabled. 0: receive data ready interrupt disabled 1: receive data ready interrupt enabled
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 412 of 862 rej09b0429-0100 15.3.7 interrupt identifi cation register (fiir) fiir consists of bits that identify interrupt sources. for details, see table 15.3. bit bit name initial value r/w description 7 6 fifoe1 fifoe0 0 0 r r fifo enable 0, 1 these bits indicate the transmit/receive fifo setting. 00: transmit/receive fifos disabled 11: transmit/receive fifos enabled 5, 4 ? all 0 r reserved these bits are always read as 0. the initial value should not be changed. 3 2 1 intid2 intid1 intid0 0 0 0 r r r interrupt id2, id1, id0 these bits indicate the interrupt of the highest priority among the pending interrupts. 000: modem status 001: fthr empty 010: receive data ready 011: receive line status 110: character timeout (when the fifo is enabled) 0 intpend 1 r interrupt pending indicates whether one or more interrupts are pending. 0: interrupt pending 1: no interrupt pending
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 413 of 862 rej09b0429-0100 table 15.3 interrupt control function fiir setting/clearing of interrupt intid 2 1 0 intpend priority type of interrupt interrupt source clearing of interrupt 0 0 0 1 ? no interrupt none ? 0 1 1 0 1 (high) receive line status overrun error, parity error, framing error, break interrupt flsr read 0 1 0 0 2 receive data ready receive data remaining, fifo trigger level frbr read or receive fifo is below trigger level. 1 1 0 0 2 character timeout (with fifo enabled) no data is input to or output from the receive fifo for the 4-character time period while one or more characters remain in the receive fifo. frbr read 0 0 1 0 3 fthr empty ft hr empty fiir read or fthr write 0 0 0 0 4 (low) modem status cts fmsr read
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 414 of 862 rej09b0429-0100 15.3.8 fifo control register (ffcr) ffcr is a write-only register that controls transmit/receive fifos. bit bit name initial value r/w description 7 6 rcvrtrig1 rcvrtrig0 0 0 w w receive fifo interrupt trigger level 1, 0 these bits set the trigger level of the receive fifo interrupt. 00: 1 byte 01: 4 bytes 10: 8 bytes 11: 14 bytes 5, 4 ? ? ? reserved these bits cannot be modified. 3 dmamode 0 ? dma mode this bit is not supported. the initial value should not be changed. 2 xmitfrst 0 w transmit fifo reset the transmit fifo data is cl eared when 1 is written. however, ftsr data is not cleared. this bit is automatically cleared. 1 rcvrfrst 0 w receive fifo reset the receive fifo data is cl eared when 1 is written. however, frsr data is not cleared. this bit is automatically cleared. 0 fifoe 0 w fifo enable 0: transmit/receive fifos disabled all bytes of these fifos are cleared. 1: transmit/receive fifos enabled
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 415 of 862 rej09b0429-0100 15.3.9 line control register (flcr) flcr sets formats of the transmit/receive data. bit bit name initial value r/w description 7 dlab 0 r/w divisor latch address fdll and fdlh are placed at the same addresses as the frbr/fthr and fier addresses. this bit selects which register is to be accessed. 0: frbr/fthr and fier access enabled 1: fdll and fdlh access enabled 6 break 0 r/w break control generates a break by driving the serial output signal txdf low. the break state is released by clearing this bit. 0: break released 1: break generated 5 stick parity 0 r stick parity this bit is not supported in this lsi. this bit is always read as 0. the initial value should not be changed. 4 eps 0 r/w parity select selects even or odd parity when the pen bit is 1. 0: odd parity 1: even parity 3 pen 0 r/w parity enable selects whether to add a parity bit for data transmission and whether to perform a parity check for data reception. 0: no parity bit added/parity check disabled 1: parity bit added/parity check enabled
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 416 of 862 rej09b0429-0100 bit bit name initial value r/w description 2 stop 0 r/w stop bit specifies the stop bit length for data transmission. for data reception, only the first stop bit is checked regardless of the setting. 0: 1 stop bit 1: 1.5 stop bits (data length: 5 bits) or 2 stop bits (data length: 6 to 8 bits) 1 0 cls1 cls0 0 0 r/w r/w character length select 0, 1 these bits specify transmit/receive character data length. 00: data length is 5 bits 01: data length is 6 bits 10: data length is 7 bits 11: data length is 8 bits 15.3.10 modem control register (fmcr) fmcr controls output signals. bit bit name initial value r/w description 7 to 5 ? all 0 r reserved these bits are always read as 0. the initial value should not be changed. 4 loop back 0 r/w loopback test the transmit data output is internally connected to the receive data input, and the transmit data output pin (rxdf) becomes 1. the receive data input pin is disconnected from external sources. the modem control input pin, cts , is disconnected from the external sources, and the pin is internally connected to the modem control output signal, rts . the transmit data is received immediately in loopback mode. enabling/disabling of interrupts is set by the out2loop bit in scifcr and fier. 0: loopback function disabled 1: loopback function enabled
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 417 of 862 rej09b0429-0100 bit bit name initial value r/w description 3 out2 0 r/w out2 ? normal operation enables or disables the scif interrupt. 0: interrupt disabled 1: interrupt enabled 2 out1 0 r/w out1 ? normal operation no effect on operation 1 rts 0 r/w request to send controls the rts output. 0: rts output is high level 1: rts output is low level 0 ? ? ? reserved
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 418 of 862 rej09b0429-0100 15.3.11 line status register (flsr) flsr is a read-only register that indicates the status info rmation of data transmission. bit bit name initial value r/w description 7 rxfifoerr 0 r receive fifo error indicates that at least one data error (parity error, framing error, or break interrupt) has occurred when the fifo is enabled. 0: no receive fifo error [clearing condition] when frbr is read or flsr is read while there is no remaining data that could cause an error after an fifo clear. 1: a receive fifo error [setting condition] when at least one data error (parity error, framing error, or break interrupt) has occurred in the fifo 6 temt 1 r transmitter empty indicates whether transmit data remains. ? when the fifo is disabled 0: transmit data remains in fthr or ftsr. [clearing condition] transmit data is written to fthr. 1: no transmit data remains in fthr and ftsr. [setting condition] when no transmit data remains in fthr and ftsr. ? when the fifo is enabled 0: transmit data remains in the transmit fifo or ftsr. [clearing condition] transmit data is written to fthr. 1: no transmit data remains in the transmit fifo and ftsr. [setting condition] when no transmit data remains in the transmit fifo and ftsr
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 419 of 862 rej09b0429-0100 bit bit name initial value r/w description 5 thre 1 r fthr empty indicates that fthr is ready to accept new data for transmission. ? when the fifo is enabled 0: transmit data of one or more bytes remains in the transmit fifo. [clearing condition] transmit data is written to fthr. 1: no transmit data remains in the transmit fifo. [setting condition] when the transmit fifo becomes empty ? when the fifo is disabled 0: transmit data remains in fthr. [clearing condition] transmit data is written to fthr 1: no transmit data in fthr [setting condition] when data transfer from fthr to ftsr is completed 4 bi 0 r break interrupt indicates detection of the receive data break signal. when the fifo is enabled, a break interrupt occurs in any receive data in the fifo, and this bit is set when the receive data is in the first fifo buffer. reception of the next data starts after the input receive data becomes mark and a valid start bit is received. 0: break signal not detected [clearing condition] flsr read 1: break signal detected [setting condition] when input receive data stays at space (low level) for a reception time exceeding the length of one frame
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 420 of 862 rej09b0429-0100 bit bit name initial value r/w description 3 fe 0 r framing error indicates that the stop bi t of the receive data is invalid. when the fifo is enabled, this error occurs in any receive data in the fifo, and this bit is set when the receive data is in the first fifo buffer. the uart attempts resynchro nization after a framing error occurs. the uart, which assumes that the framing error is due to the next start bit, samples the start bit and treats it as a start bit. 0: no framing error [clearing condition] flsr read 1: a framing error [setting condition] invalid stop bit in the receive data 2 pe 0 r parity error this bit indicates a parity error in the receive data when the pen bit in flcr is 1. when the fifo is enabled, this error occurs in any receive data in the fifo, and this bit is set when the receive data is in the first fifo buffer. 0: no parity error [clearing condition] flsr read if this bit is set during an overrun error, read flsr twice. 1: a parity error [setting condition] detection of parity error in receive data
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 421 of 862 rej09b0429-0100 bit bit name initial value r/w description 1 oe 0 r overrun error indicates occurrence of an overrun error. ? when the fifo is disabled when reception of the next data has been completed without the receive data in frbr having been read, an overrun error occurs and the previous data is lost. ? when the fifo is enabled when the fifo is full and re ception of the next data has been completed, an overrun error occurs. the fifo data is retained, but the last received data is lost. 0: no overrun error [clearing condition] flsr read 1: an overrun error [setting condition] occurrence of an overrun error 0 dr 0 r data ready indicates that receive data is stored in frbr or the fifo. 0: no receive data [clearing condition] frbr is read or all of the fifo data is read. 1: receive data remains. [setting condition] reception of data
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 422 of 862 rej09b0429-0100 15.3.12 modem status register (fmsr) fmsr is a read-only register that indicates the status of or a change in the modem control pins. bit bit name initial value r/w description 7 to 5 ? ? ? reserved 4 cts 0 r clear to send indicates the inve rted state of the cts input pin. 3 to 1 ? ? ? reserved 0 dcts 0 r delta clear to send indicator indicates a change in the cts input signal after the dcts bit is read. 0: no change in the cts input signal after fmsr read [clearing condition] fmsr read 1: a change in the cts input signal after fmsr read [setting condition] a change in the cts input signal 15.3.13 scratch pad register (fscr) fscr is not used for scif control, but is used to temporarily store program data. bit bit name initial value r/w description 7 to 0 bit 7 to bit 0 all 0 r/w temporarily stores program data.
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 423 of 862 rej09b0429-0100 15.3.14 scif control register (scifcr) scifcr controls scif operations, an d is accessible only from the cpu. bit bit name initial value r/w description 7 6 scifoe1 scifoe0 0 0 r/w r/w these bits enable or di sable port output of the scif. the port function differs according to the combination with the scif bit in hicr5 of the lpc. for details, see table 15.4. 5 ? 0 r/w reserved do not change the initial value. 4 out2loop 0 r/w enables or disables interrupts during a loopback test. 0: interrupt enabled 1: interrupt disabled 3 2 cksel1 cksel0 0 0 r/w r/w these bits select the clock (sclk) to be input to the baud rate generator. 00: lclk divided by 18 01: system clock divided by 11 10: reserved for lclk (not selectable) 11: reserved for system clock (not selectable) 1 scifrst 0 r/w resets the baud rate generator, frsr, and ftsr. 0: normal operation 1: reset 0 regrst 0 r/w resets registers (except scifcr) accessible from the h8s cpu or lpc interface. 0: normal operation 1: reset
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 424 of 862 rej09b0429-0100 table 15.4 scif output setting bit scife in hicr5 0 1 scifoe1 0 1 0 1 scifoe0 0 1 0 1 0 1 0 1 p65 pin port port rts port rts port rts port p50 pin port port txdf tx df txdf txdf txdf txdf note: p51 and p64 are input to the scif even when the outputs on the p65 and p50 pins are set to port.
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 425 of 862 rej09b0429-0100 15.4 operation 15.4.1 baud rate the scif includes a baud rate generator and can set the desired baud rate using registers fdlh, fdll, and the cksel bit in scifcr. table 15.5 shows an example of baud rate settings. table 15.5 example of baud rate settings 00 01 cksel1, cksel0 lclk (33 mhz) divided by 18 system clock (34 mhz) divided by 11 baud rate fdlh, fdll (hex) error (%) fdlh, fdll (hex) error (%) 50 0900 -0.54 % h'0f18 -0.01% 75 0600 -0.54 % h'0a10 -0.01% 110 0417 -0.51 % h'06dc 0.01% 300 0180 -0.54 % h'0284 -0.01% 600 00c0 -0.54 % h'0142 -0.01% 1200 0060 -0.54 % h'00a1 -0.01% 1800 0040 -0.54 % h'006b 0.30% 2400 0030 -0.54 % h'0050 0.62% 4800 0018 -0.54 % h'0028 0.62% 9600 000c -0.54 % h'0014 0.62% 14400 0008 -0.54 % h'000d ? 19200 0006 -0.54 % h'000a 0.62% 38400 0003 -0.54 % h'0005 0.62% 57600 0002 -0.54 % h'0003 ? 115200 0001 -0.54 % h'0002 ?
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 426 of 862 rej09b0429-0100 15.4.2 operation in asyn chronous communication figure 15.2 illustrates the typi cal format for asynch ronous serial communication. one frame consists of a start bit (low level), followed by transmit/receive data (lsb -first: from the least significant bit), a parity bit, and a stop bit (high level). in asynchronous serial communication, the transmission line is usually held high in the mark state (high level). the scif monitors the transmission line, and when it detects the space st ate (low level), recognizes a start bit and starts serial communication. inside the scif, the tr ansmitter and receiver ar e independent units, enabling full-duplex communication. both of the transmitter and receiver also have a 16-stage fifo buffered structure so that data can be read or written during transmission or reception, enabling continuous data tr ansmission and reception. serial data 1 1 0 d0 d1 d2 d3 d4 d5 d6 d7 0/1 11 idle state (mark state) transmit/receive data stop bit 1, 1.5, or 2 bits 1 bit 1 bit or none 5, 6, 7, or 8 bits start bit parity bit one unit of transfer data (character or frame) figure 15.2 data format in serial transmission/reception (example with 8-bit data, parity and 2 stop bits)
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 427 of 862 rej09b0429-0100 15.4.3 initialization of the scif (1) initialization of the scif use an example of the flowchart in figure 15. 3 to initialize the scif before transmitting or receiving data. end of initialization start initialization clear module stop set scifcr set dlab bit in flcr to 1 set fdlh and fdll clear dlab bit in flcr to 0 set data transfer format in flcr set interrupt enable bits in fier set fifoe bit in ffcr to 1 set receive fifo trigger level in ffcr set xmitfrst and rcvrfrst bits in ffcr to 1 to reset fifos [1] [2] [3] [4] [5] [1] [2] [3] [4] [5] [9] [9] [6] [7] [8] [6] [7] [8] fifos used? yes no select an input clock with the cksel1 and cksel0 bits in scifcr. set the scif input/ output pins with the scifoe1 and scifoe0 bits in scifcr. set the dlab bit in flcr to 1 to enable access to fdll and fdlh. the initial value of fdll and fdlh is 0. set a value within the range from 1 to 65535. clear the dlab bit in flcr to 0 to disable access to fdll and fdlh. select parity with the eps and pen bits in flcr, and set the stop bit with the stop bit in flcr. then, set the data length with the cls1 and cls0 bits in flcr. when fifos are used, set the fifoe bit in ffcr to 1. set the receive fifo trigger level with the rcvrtrig1 and rcvrtrig0 bits in ffcr. set the xmitfrst and rcvrfrst bits in ffcr to 1 to reset the fifos. enable or disable an interrupt with the edssi, elsi, etbei, and erbfi bits in fier and the out2 bit in fmcr. figure 15.3 example of initialization flowchart
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 428 of 862 rej09b0429-0100 (2) serial data transmission figure 15.4 shows an example of the data transmission flowchart. start transmission read thre flag in flsr write transmit data to fthr read temt flag in flsr thre = 1? all data written yes no no no yes yes temt = 1 no yes break output (end of transmission or transmission standby) yes break time completed initialization set break bit in flcr to 1 clear break bit in flcr to 0 [1] [2] [3] [1] confirm that the thre flag in flsr is 1, and write transmit data to fthr. when fifos are used, write 1-byte to 16-byte transmit data. when the out2 bit in fmcr and the etbei bit in fier are set to 1, an fthr empty interrupt occurs. when data is written to fthr, it is transferred automatically to ftsr. the data is then transmitted from the ftxd pin in the order of the start bit, transmit data, parity bit, and stop bit. [2] read the temt flag in flsr, and confirm that temt is set to 1 to ensure that all transmit data has been transmitted. [3] to output a break at the end of serial transmission, set the break bit in flcr to 1. after completion of the break time, clear the break bit in flcr to 0 to clear the break. figure 15.4 example of data transmission flowchart
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 429 of 862 rej09b0429-0100 (3) serial data reception figure 15.5 shows an example of the data reception flowchart. start reception read dr flag in flsr read flsr read frbr error processing read flsr dr = 1 rxfifoerr = 1, bi = 1, fe = 1, pe = 1, or oe = 1 yes no no no no yes yes all data read (end of reception or reception standby) yes initialization [1] [2] [3] [4] dr = 0 [1] confirm that the dr flag in flsr is 1 to ensure that receive data is in the buffer. when the out2 bit in fmcr and the erbfi bit in fier are set to 1, a receive data ready interrupt occurs. [2] read the rxfifoerr, bi, fe, pe, and oe flags in flsr to ensure that no error has occurred. if an error has occurred, perform error processing. when the out2 bit in fmcr and the elsi bit in fier are set to 1, a receive line status interrupt occurs. [3] read the receive data in frbr. [4] check the dr flag in flsr. when the dr flag is cleared to 0 and all data has been read, data reception is complete. figure 15.5 example of data reception flowchart
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 430 of 862 rej09b0429-0100 15.4.4 data transmission/r eception with flow control the following shows examples of data transmission/reception for flow control using cts and rts. (1) initialization figure 15.6 shows an example of the initialization flowchart. start initialization (transmission/reception standby flow) clear module stop set scifcr set dlab bit in flcr to 1 set fdlh and fdll clear dlab bit in flcr to 0 set data transfer format in flcr set fifo with ffcr set interrupt enable bits in fier set rts bit in fmcr to 1 [1] [2] [3] [4] [5] [6] [7] [8] [1] select an input clock with the cksel1 and cksel0 bits in scifcr. set the scif input/output pins with the scifoe1 and scifoe0 bits in scifcr. [2] set the dlab bit in flcr to 1 to enable access to fdll and fdlh. [3] the initial value of fdll and fdlh is 0. set a value within the range from 1 to 65535. [4] clear the dlab bit in flcr to 0 to disable access to fdll and fdlh. [5] select parity with the eps and pen bits in flcr, and set the stop bit with the stop bit in flcr. then, set the data length with the cls1 and cls0 bits in flcr. set the fifoe bit in ffcr to 1 to enable the fifo. [6] set the receive fifo trigger level with the rcvrtrig1 and rcvrtrig0 bits in ffcr. select the best trigger level to prevent an overflow of the receive fifo. [7] set the edssi and erbfi bits in fier to 1 to enable a modem status interrupt and receive data ready interrupt. [8] set the rts bit in fmcr to 1. figure 15.6 example of initialization flowchart
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 431 of 862 rej09b0429-0100 (2) data transmission/reception standby figure 15.7 shows an example of the data transmission/reception standby flowchart. no no yes transmit data exists? (transmission flow) (reception flow) yes initialization [1] [2] [1] when a receive data ready interrupt occurs, go to the reception flow. [2] when transmit data exists, go to the transmission flow. receive data ready interrupt? figure 15.7 example of data tran smission/reception standby flowchart
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 432 of 862 rej09b0429-0100 (3) data transmission figure 15.8 shows an example of the data transmission flowchart. read cts flag in fmsr read thre flag in flsr i 0 i i + 1 write transmit data to transmit fifo cts = 1 thre = 1 yes no no no no yes yes (end of transmission or transmission standby) yes transmission/reception standby [1] [2] [3] [4] [1] confirm that the cts flag in fmsr is 1. [2] confirm that the thre flag in flsr is 1 to ensure that the transmit fifo is empty. [3] write up to 16 bytes of transmit data in the transmit fifo. if the transmit data is 17 bytes or more, return to step [2] to write transmit data in the transmit fifo again. [4] when all of the data has been written, go to the transmission/reception standby flow. i < 16? all data written figure 15.8 example of data transmission flowchart
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 433 of 862 rej09b0429-0100 (4) suspension of data transmission figure 15.9 shows an example of the data transmission suspension flowchart. read dcts flag in fmsr modem status change interrupt suspend data write to transmit fifo set xmitfrst bit in ffcr to 1 (other processing) prepare for retransmission (transmission flow) dcts = 1 no yes [ 1 ] [ 2 ] [ 3 ] [ 4 ] [1] read the dcts flag in fmsr in the modem status change interrupt processing routine. if the dcts flag is set to 1, the transmission suspension processing starts. [2] suspend data write to the transmit fifo. [3] set the xmitfrst bit in ffcr to 1. [4] prepare for retransmission of data and go to the transmission flow. figure 15.9 example of data transmission suspension flowchart
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 434 of 862 rej09b0429-0100 (5) data reception figure 15.10 shows an example of the data reception flowchart. read flsr receive data ready interrupt read receive fifo read flsr error processing (transmission/reception standby flow) bi = 1, fe = 1, pe = 1, or oe = 1 dr = 0 no yes [1] [2] [3] [4] [1] when data is received, a receive data ready interrupt occurs. go to the data reception flow by using this interrupt trigger. [2] confirm that the bi, fe, pe, and oe flags in flsr are all cleared. if any one of these flags is set to 1, perform error processing. [3] read the receive fifo. [4] check the dr flag in flsr. when the dr flag is cleared and all of the data has been read, data reception is complete. figure 15.10 example of data reception flowchart
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 435 of 862 rej09b0429-0100 (6) suspension of data reception figure 15.11 shows an ex ample of the data receptio n suspension flowchart. clear rts bit in fmcr to 0 receive fifo trigger level interrupt read receive fifo read flsr set rts bit in fmcr to 1 (transmission/reception standby flow) dr = 0 no yes [1] [2] [3] [4] [1] when data is received at a trigger level higher than the receive fifo trigger level specified in the initialization flow, a receive fifo trigger level interrupt occurs. [2] clear the rts bit in fmcr to 0. [3] read the receive fifo until the dr flag is cleared to 0. [4] set the rts bit in fmcr to 1, and then go to the transmission/reception standby flow. figure 15.11 example of data reception suspension flowchart
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 436 of 862 rej09b0429-0100 15.4.5 data transmission/recept ion through the lpc interface as shown in table 15.2, setting the scife bit in hicr5 to 1 allows registers (except scifcr) to be accessed from the lpc interface. the initial se tting of scifcr by the cpu and setting of the scife bit in hicr5 to 1 enable the flow settings for initialization and data transmission/reception shown in figures 15.3 to 16.5 to be made from the lpc interface. table 15.6 shows the correspondence between lpc interf ace i/o address and access to the scif registers. for details of the lpc interface settings, see s ection 18, lpc interface (lpc). table 15.6 correspondence between lpc inte rface i/o address and the scif registers lpc interface i/o address bits 15 to 3 bit 2 bit 1 bit 0 r/w condition scif register r flcr[7] = 0 frbr w flcr[7] = 0 fthr scifadr (bits 15 to 3) 0 0 0 r/w flcr[7] = 1 fdll r/w flcr[7] = 0 fier scifadr (bits 15 to 3) 0 0 1 r/w flcr[7] = 1 fdlh r ? fiir scifadr (bits 15 to 3) 0 1 0 w ? ffcr scifadr (bits 15 to 3) 0 1 1 r/w ? flcr scifadr (bits 15 to 3) 1 0 0 r/w ? fmcr scifadr (bits 15 to 3) 1 0 1 r ? flsr scifadr (bits 15 to 3) 1 1 0 r ? fmsr scifadr (bits 15 to 3) 1 1 1 r/w ? fscr
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 437 of 862 rej09b0429-0100 table 15.7 shows the register states related to data transmission/reception through the lpc interface. table 15.7 register states register system reset lpc reset lpc shutdown lpc abort scifadrh bits 15 to 8 initialized retained retained retained scifadrl bits 7 to 0 initialized retained retained retained hicr5 scife initialized retained retained retained bits 7 to 4 initialized retained retained retained scsirq3 initialized retained retained retained scsirq2 initialized retained retained retained scsirq1 initialized retained retained retained sirqcr4 scsirq0 initialized retained retained retained
section 15 serial communication interface with fifo (scif) rev. 1.00 mar. 17, 2008 page 438 of 862 rej09b0429-0100 15.5 interrupt sources table 15.8 lists the interrupt sources. a common interrupt vector is assigned to each interrupt source. when the lpc uses the scif, the lpc does not reque st any interrupts to be sent to the h8s cpu. the serirq signal of the lpc interface tran smits an interrupt request to the host. table 15.8 interrupt sources interrupt name interrupt source priority receive line status overrun error, parity error, framing error, break interrupt receive data ready acceptance of re ceive data, fifo trigger level character timeout (when fifo is enabled) no data is input to or output fr om the receive fifo for the 4- character time period while one or more characters remain in the receive fifo. fthr empty fthr empty modem status cts high low table 15.9 shows the interrupt source, v ector address, and interrupt priority. table 15.9 interrupt so urce, vector address, and interrupt priority interrupt origin of interrupt source interrupt name vector number vector address icr scif scif 82 h'000148 icrc7 15.6 usage note 15.6.1 power-down mode when lclk is selected for sclk to switch to software standby mode when lclk divided by 18 has been selected for sclk, use the shutdown function of the lpc interface to stop lclk.
section 16 serial pin multiplexed modes rev. 1.00 mar. 17, 2008 page 439 of 862 rej09b0429-0100 section 16 serial pin multiplexed modes three serial communication i/f modules (scif, sc i_1 and sci_3) can be configured for five types of com port assignments and internal connections (serial pin multiplexed modes) in this lsi. two registers are provided for controllin g the serial pin multiplexed modes: serial multiplexed mode register 0 (smr0) and se rial multiplexed mode register 1 (smr1). 16.1 features internal connection of serial modules to com ports can be configured to make a software bridge for ipmi applications. ? five serial pin multiplexed modes ? mode 0: each com port is used for its re spective serial communi cation module: com1 for scif, com2 for sci_1 and com3 for sci_3 (default mode) ? mode 1: com1 snoop mode with use of sci_1 and internal registers ? mode 2: scif-and-sci_1 bridge mode in which internal registers provide software flow control. ? mode 3: com port switched mode in which com1 is connected to sci_1 and com2 is connected to scif. internal registers provide flow control for sci_1. ? mode 4: scif-and-sci_3 bridge mode providing the same functionality as mode 3. please refer to section 13, seri al communication interface (sci) fo r details on sci_1 and sci_3, and section 15, serial commun ication interface with fifo (s cif), for details on scif.
section 16 multiplex mode rev. 1.00 mar. 17, 2008 page 440 of 862 rej09b0429-0100 16.2 input/output pins table 16.1 lists input/output pins involved in serial pin multiplexed modes. table 16.1 pin configuration module symbol i/o function port pin scif txdf output transmit data p50 rxdf input receive data p51 cts input transmission permission p64 rts output transmission request p65
section 16 serial pin multiplexed modes rev. 1.00 mar. 17, 2008 page 441 of 862 rej09b0429-0100 16.3 register descriptions two registers are provided for serial pin multiplexe d modes. serial multip lexed mode register 0 (smr0) enables or disables the serial pin multiplexing function, selects a serial pin multiplexed mode out of 5 modes, and provides bits for port monitoring. serial multiplexed mode register 1 (smr1) provides bits for port monitoring and controls outputs on the relevant port pins. ? serial multiplexed mode register 0 (smr0) ? serial multiplexed mode register 1 (smr1) 16.3.1 serial multiplexed mode register 0 (smr0) bit bit name initial value r/w description 7 to 5 ? ? r reserved 4 sme 0 r/w serial pin multiplex enable 0: pin multiplexing disabled 1: pin multiplexing enabled 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 sm2 0 r/w 1 sm1 0 r/w 0 sm0 0 r/w serial pin multiplexed mode select these bits select a serial pin multiplexed mode. this selection is only enabled when sme bit is 1. 000: serial multiplexed mode 0 001: serial multiplexed mode 1 010: serial multiplexed mode 2 011: serial multiplexed mode 3 100: serial multiplexed mode 4 101: reserved (do not modify) 110: reserved (do not modify) 111: reserved (do not modify)
section 16 multiplex mode rev. 1.00 mar. 17, 2008 page 442 of 862 rej09b0429-0100 16.3.2 serial multiplexed mode register 1 (smr1) bit bit name initial value r/w description 7 cts1 ? r monitors the state of the cts pin of com1 in mode 1. monitors the state of the rts pin of scif in mode 2. 6 ? ? r reserved 5 rts1 1 r/w controls the output on the rts pin of com1. controls the input on the cts pin of scif in mode 2. 0: 0 is output 1: 1 is output 4 cts3 ? r monitors the state of the rts pin input of the scif in mode 4. 3 ? ? r reserved 2 rts3 1 r/w controls the output on the cts pin of the scif. 0: 0 is output 1: 1 is output 1,0 ? ? r/w reserved
section 16 serial pin multiplexed modes rev. 1.00 mar. 17, 2008 page 443 of 862 rej09b0429-0100 16.4 operation of serial pin multiplexed modes 16.4.1 serial pin multiplexed mode 0 (default; smr0 register [bits sm2, sm1, sm0] = [0 0 0]) this mode is the default configuration and e ach com port is used for its respective serial communication module: com1 works with scif, com2 with sci_1, and com3 with sci_3. cts , rts , rxdf, and txdf of scif ar e connected to the correspond ing pins of com1. tx/rx of com1 are tied across to rxdf /txdf (cross connection). rxd1 and txd1 of sci_1 are cross-connected to com2. rxd3 and txd3 of sci_3 are cross- connected to com3. figure 16.1 illustrates the pin connection in serial pin multiplexed mode 0. com2 com3 sci_1 sci_3 bmc (h8s) rxd1 txd1 rxd3 txd3 rx tx rx tx com1 scif p64 p65 p86 p87 p51 p50 p53 p52 cts rts rxdf txdf cts rts rx tx figure 16.1 serial pin multiplexed mode 0
section 16 multiplex mode rev. 1.00 mar. 17, 2008 page 444 of 862 rej09b0429-0100 16.4.2 serial pin multiplexed mode 1 (smr0 register [bits sm2, sm1, sm0] = [0 0 1]) this mode is ?com1 snoop mode? with use of sci_1 and internal registers. cts , rts , rxdf, and txdf of scif are connected to com1. rxd1 of sci_1 is connected to rxdf of scif internally and txd1 of sci_1 is unused. so, com2 is not available (n/a) and rx of com2 is fixed at 1. rxd3 and txd3 of sci_3 are cross-connected to com3. the pin state of cts of com1 is reflected in bit cts1 of the smr1 register. figure 16.2 illustrates the pin connection in serial pin multiplexed mode 1. com2 com3 sci_1 sci_3 bmc (h8s) rxd1 txd1 rxd3 txd3 rx tx rx tx com1 scif p64 p65 p86 p87 p51 p50 cts rts rxdf txdf cts rts rx tx cts1 rts1 cts3 smr1 rts3 p53 p52 figure 16.2 serial pin multiplexed mode 1
section 16 serial pin multiplexed modes rev. 1.00 mar. 17, 2008 page 445 of 862 rej09b0429-0100 16.4.3 serial pin multiplexed mode 2 (smr0 register [bits sm2, sm1, sm0] = [0 1 0]) in this mode, scif and sci_1 are internally connected. com1 is not available (n/a) and rts /rx of com1 are fixed at 1. cts , rts , rxdf, and txdf of scif are disconnected from com1. rxdf/txdf of scif are cross-connected to txd1/rxd1 of sci_1 internally. com2 is not available (n/a) and rx of com2 is fixed at 1. rxd3 and txd3 of sci_3 are connected to tx and rx of com3. the value written to bit rts1 of the smr1 register is reflected in the cts input of scif. the state of rts of scif is reflected in bit cts1 of the smr1 register. figure 16.3 illustrates the pin connection in serial pin multiplexed mode 2. com3 sci_1 sci_3 bmc (h8s) rxd1 txd1 rxd3 txd3 rx tx scif p64 p65 p86 p87 p51 p50 p53 p52 cts rts rxdf txdf cts1 rts1 cts3 smr1 rts3 figure 16.3 serial pin multiplexed mode 2
section 16 multiplex mode rev. 1.00 mar. 17, 2008 page 446 of 862 rej09b0429-0100 16.4.4 serial pin multiplexed mode 3 (smr0 register [bits sm2, sm1, sm0] = [0 1 1]) this mode enables the use of com2 by scif and com1 by sci_1. since sci_1 doesn?t use any hardware pins for flow control, emulation is possible using the internal registers. tx/rx of com1 are connected to rxd1/txd1 of sci_1, and other com1 port signals are controlled or monitored through bits in the intern al registers. rxdf/txdf of scif are connected to tx/rx of com2 and other scif signals are not used. cts of scif is fixed at 1. rxd3 and txd3 of sci_3 are connected to tx and rx of com3. the state of cts of com1 is reflected in b it cts1 of the smr1 register. the values written to bits dtr1/rts1 of the smr1 register are output to dtr / rts of com1. figure 16.4 illustrates the pin connection in serial pin multiplexed mode 3. com2 com3 sci_1 sci_3 bmc (h8s) rxd1 txd1 rxd3 txd3 rx tx rx tx com1 scif p64 p65 p86 p87 p51 p50 p53 p52 cts rts rxdf txdf cts rts rx tx cts1 rts1 cts3 smr1 rts3 1 open figure 16.4 serial pin multiplexed mode 3
section 16 serial pin multiplexed modes rev. 1.00 mar. 17, 2008 page 447 of 862 rej09b0429-0100 16.4.5 serial pin multiplexed mode 4 (smr0 register [bits sm2, sm1, sm0] = [1 0 0]) mode 4 provides the same function as mode 3, but the data lines of sci_3 and scif are cross- connected. rxd1/txd1 of sci_1 are connected to tx/rx of com1, and internal register bits emulate other signals of com1. cts of scif is fixed at 1. com2 is not available (n/a) and rx for com2 is fixed at 1. com3 is not available (n/a) and rx for com3 is fixed at 1. rxd3/txd3 of sci_3 are cross-connected to txdf/rxdf of scif internally. the state of cts of com1 is reflected to cts1 bit of smr1 register. the values written to bits dtr1/rts1 of the smr1 register are output to rts of com1. the value written to bit rts3 of smr1 is reflected in cts of scif, and the state of rts of scif is reflected in bit cts3 of smr1, allowing sci_3 and scif to communicate each other with virtual flow control. figure 16.5 illustrates the pin connection in serial pin multiplexed mode 4. com2 com3 sci_1 sci_3 bmc (h8s) rxd1 txd1 rxd3 txd3 rx tx rx tx com1 scif p64 p65 p86 p87 p51 p50 p53 p52 cts rts rxdf txdf cts rts rx tx cts1 rts1 cts3 smr1 rts3 figure 16.5 serial pin multiplexed mode 4
section 16 multiplex mode rev. 1.00 mar. 17, 2008 page 448 of 862 rej09b0429-0100 16.5 serial port pin configuration (a) sme = 1: sci (scif) with serial pin multiplexed mode enabled (b) sme = 0: sci (scif) with seri al pin multiplexed mode disabled
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 449 of 862 rej09b0429-0100 section 17 i 2 c bus interface (iic) this lsi has six-channels of i 2 c bus interface (iic). the i 2 c bus interface conforms to and provides a subset of the philips i 2 c bus (inter-ic bus) interface func tions. however, the register configuration that controls the i 2 c bus differs partly from the philips configuration. 17.1 features ? selection of addressing format or non-addressing format ? i 2 c bus format: addressing format with acknowledge bit, for master/slave operation ? clocked synchronous serial format: non-addressing format without acknowledge bit, for master operation only ? conforms to philips i 2 c bus interface (i 2 c bus format) ? two ways of setting slave address (i 2 c bus format) ? start and stop conditions generated automatically in master mode (i 2 c bus format) ? selection of acknowledge output levels when receiving (i 2 c bus format) ? automatic loading of acknowledge bit when transmitting (i 2 c bus format) ? wait function in master mode (i 2 c bus format) ? a wait can be inserted by driving the scl pin low after data transfer, excluding acknowledgement. ? the wait can be cleared by clearing the interrupt flag. ? wait function (i 2 c bus format) ? a wait request can be generated by driving the scl pin low after data transfer. ? the wait request is cleared when th e next transfer becomes possible. ? interrupt sources ? data transfer end (including when a transition to transmit mode with i 2 c bus format occurs, when icdr data is transferre d, or during a wait state) ? address match: when any slave address matche s or the general call address is received in slave receive mode with i 2 c bus format (includi ng address reception after loss of master arbitration) ? arbitration loss ? start condition detection (in master mode) ? stop condition detection (in slave mode) ? selection of 32 internal clocks (in master mode) ? direct bus drive
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 450 of 862 rej09b0429-0100 ? pins scl0 to scl5 and sda0 to sda5 (normally nmos push-pull outputs) function as nmos open-drain outputs when the bus drive function is selected. figure 17.1 shows a block diagram of the i 2 c bus interface. figure 17.2 shows an example of i/o pin connections to external circuits. since i 2 c bus interface i/o pins are different in structure from normal port pins, they have different specifications for permissible applied voltages. for details, see section 26, electri cal characteristics. scl ps iccr icxr icmr icsr icdrs sar, sarx sda iccr: icmr: icsr: icdr: icxr: sar: sarx: ps: icdrr icdrt noise canceler bus state decision circuit arbitration decision circuit clock control address comparator interrupt generator internal data bus output data control circuit noise canceler interrupt generator [legend] i 2 c bus control register i 2 c bus mode register i 2 c bus status register i 2 c bus data register i 2 c bus extended control register slave address register slave address register x prescaler figure 17.1 block diagram of i 2 c bus interface
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 451 of 862 rej09b0429-0100 scl in scl out sda in sda out (slave 1) scl sda scl in scl out sda in sda out (slave 2) scl sda scl in scl out sda in sda out (master) this lsi scl sda v cc v dd v cc scl sda figure 17.2 i 2 c bus interface connections (example: this lsi as master)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 452 of 862 rej09b0429-0100 17.2 input/output pins table 17.1 summarizes the input/output pins used by the i 2 c bus interface. table 17.1 pin configuration channel symbol * input/output function scl0 input/output clock input/ output pin of channel iic_0 0 sda0 input/output data inpu t/output pin of channel iic_0 scl1 input/output clock input/ output pin of channel iic_1 1 sda1 input/output data inpu t/output pin of channel iic_1 scl2 input/output clock input/ output pin of channel iic_2 2 sda2 input/output data inpu t/output pin of channel iic_2 scl3 input/output clock input/ output pin of channel iic_3 3 sda3 input/output data inpu t/output pin of channel iic_3 scl4 input/output clock input/ output pin of channel iic_4 4 sda4 input/output data inpu t/output pin of channel iic_4 scl5 input/output clock input/ output pin of channel iic_5 5 sda5 input/output data inpu t/output pin of channel iic_5 note: * in the text, the channel subscript is omitted, and only scl and sda are used.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 453 of 862 rej09b0429-0100 17.3 register descriptions the i 2 c bus interface has the following registers. registers icdr and sarx and registers icmr and sar are allocated to the same addresses. accessible regist ers differ depending on the ice bit in iccr. when the ice b it is cleared to 0, sar and sarx can be accessed, and when the ice bit is set to 1, icmr and icdr can be accessed. ? i 2 c bus data register (icdr) ? slave address register (sar) ? second slave address register (sarx) ? i 2 c bus mode register (icmr) ? i 2 c bus transfer rate select register (iicx3) ? i 2 c bus control register (iccr) ? i 2 c bus status register (icsr) ? i 2 c bus extended control register (icxr) ? i 2 c smbus control register (icsmbcr) 17.3.1 i 2 c bus data register (icdr) icdr is an 8-bit readable/writable register that is used as a transmit data register when transmitting and a receive data register when recei ving. icdr is divided internally into a shift register (icdrs), receive buffer (icdrr), and tr ansmit buffer (icdrt). data transfers among the three registers are performed auto matically in accordance with chan ges in the bus state, and they affect the status of internal flags such as icdre and icdrf. in master transmit mode with the i 2 c bus format, writing transmit data to icdr should be performed after start condition detection. when the start condition is detected, previous write data is ignored. in slave transmit mode, writing should be performed after the slave addresses match and the trs bit is automatically changed to 1. if iic is in transmit mode (trs=1) and the next data is in icdrt (the icdre flag is 0), data is transferred automatically from icdrt to icdrs, following transmission of one frame of data using icdrs. when the icdre flag is 1 and the next transmit data writing is waited, data is transferred automatically from icdrt to icdrs by writing to icdr. if iic is in receive mode (trs=0), no data is transferred from icdrt to icdrs. note that data should not be written to icdr in receive mode. reading receive data from icdr is performed af ter data is transferred from icdrs to icdrr.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 454 of 862 rej09b0429-0100 if iic is in receive mode and no previous data remains in icdrr (the icdrf flag is 0), data is transferred automatically from ic drs to icdrr, following reception of one frame of data using icdrs. if additional data is received while the icdr f flag is 1, data is transferred automatically from icdrs to icdrr by reading from icdr. in transmit mode, no data is transferred from icdrs to icdrr. always set iic to r eceive mode before reading from icdr. if the number of bits in a frame, excluding the ackno wledge bit, is less than eight, transmit data and receive data are stored differ ently. transmit data should be written justified toward the msb side when mls = 0 in icmr, and toward the lsb side when mls = 1. receive data bits should be read from the lsb side when mls = 0, and from the msb side when mls = 1. icdr can be written to and read from only when the ice bit is set to 1 in iccr. the initial value of icdr is undefined. 17.3.2 slave address register (sar) sar sets the slave address and selects the communi cation format. when the lsi is in slave mode with the i 2 c bus format selected, if the fs bit is set to 0 and the upper 7 bits of sar match the upper 7 bits of the first frame received after a star t condition, the lsi operates as the slave device specified by the master device. sar can be accesse d only when the ice bit in iccr is cleared to 0. bit bit name initial value r/w description 7 6 5 4 3 2 1 sva6 sva5 sva4 sva3 sva2 sva1 sva0 all 0 r/w slave addresses 6 to 0 set a slave address. 0 fs 0 r/w format select selects the communication fo rmat together with the fsx bit in sarx. refer to table 17.2. this bit should be set to 0 when general call address recognition is performed.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 455 of 862 rej09b0429-0100 17.3.3 second slave address register (sarx) sarx sets the second slave address and sele cts the communication format. in slave mode, transmit/receive operatio ns by the dtc are possible when the received address matches the second slave address. when the ls i is in slave mode with the i 2 c bus format selected, if the fsx bit is set to 0 and the upper 7 bits of sarx matc h the upper 7 bits of the first frame received after a start condition, the lsi operates as the slave de vice specified by the master device. sarx can be accessed only when the ice bit in iccr is cleared to 0. bit bit name initial value r/w description 7 6 5 4 3 2 1 svax6 svax5 svax4 svax3 svax2 svax1 svax0 all 0 r/w second slave addresses 6 to 0 set the second slave address. 0 fsx 1 r/w format select x selects the communication format together with the fs bit in sar. refer to table 17.2.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 456 of 862 rej09b0429-0100 table 17.2 transfer format sar sarx fs fsx operating mode 0 0 i 2 c bus format ? sar and sarx slave addresses recognized ? general call address recognized 1 i 2 c bus format ? sar slave address recognized ? sarx slave address ignored ? general call address recognized 1 0 i 2 c bus format ? sar slave address ignored ? sarx slave address recognized ? general call address ignored 1 clocked synchronous serial format ? sar and sarx slave addresses ignored ? general call address ignored ? i 2 c bus format: addressing fo rmat with acknowledge bit ? clocked synchronous serial format: non-addressing format without acknowledge bit, for master mode only
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 457 of 862 rej09b0429-0100 17.3.4 i 2 c bus mode register (icmr) icmr sets the communication form at and transfer rate. it can only be accessed when the ice bit in iccr is set to 1. bit bit name initial value r/w description 7 mls 0 r/w msb-first/lsb-first select 0: msb-first 1: lsb-first set this bit to 0 when the i 2 c bus format is used. 6 wait 0 r/w wait insertion bit this bit is valid only in master mode with the i 2 c bus format. 0: data and the acknowledge bit are transferred consecutively with no wait inserted. 1: after the fall of the clock for the final data bit (8th clock), the iric flag is set to 1 in iccr, and a wait state begins (with scl at the low level). when the iric flag is cleared to 0 in iccr, the wait ends and the acknowledge bit is transferred. for details, refer to secti on 17.4.7, iric setting timing and scl control. 5 4 3 cks2 cks1 cks0 all 0 r/w transfer clock select these bits are used only in master mode. these bits select the required transfer clock rate, together with bits iicx5 (channel 5), iicx4 (channel 4), and iicx3 (channel 3) in the iicx3 register and bits iicx2 (channel 2), iicx1 (channel 1), and iicx0 (channel 0) in the stcr register. refer to table 17.3.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 458 of 862 rej09b0429-0100 bit bit name initial value r/w description 2 1 0 bc2 bc1 bc0 all 0 r/w bit counter these bits specify the number of bits to be transferred next. bit bc2 to bc0 settings should be made during an interval between transfer frames. if bits bc2 to bc0 are set to a value other than b'000, the setting should be made while the scl line is low. the bit counter is initialized to b'000 when a start condition is detected. the value returns to b'000 at the end of a data transfer. i 2 c bus format clocked synchronous serial mode b'000: 9 bits b'000: 8 bits b'001: 2 bits b'001: 1 bits b'010: 3 bits b'010: 2 bits b'011: 4 bits b'011: 3 bits b'100: 5 bits b'100: 4 bits b'101: 6 bits b'101: 5 bits b'110: 7 bits b'110: 6 bits b'111: 8 bits b'111: 7 bits
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 459 of 862 rej09b0429-0100 17.3.5 i 2 c bus transfer rate select register (iicx3) iicx3 selects the iic transfer rate clock and sets the transfer rate of iic channel 3. bit bit name initial value r/w description 7 to 4 ? ? ? reserved these bits cannot be modified. the read values are undefined. 3 tcss 0 r/w transfer rate clock source select this bit selects a clock rate to be applied to the i 2 c bus transfer rate. 0: /2 1: /4 2 1 0 iicx5 iicx4 iicx3 0 0 0 r/w r/w r/w iic transfer rate select 5, 4, 3 these bits are used to control iic_5 to iic_3 operation. these bits select the transfer rate in master mode, together with the cks2 to cks0 bits in icmr. for the transfer rate, see table 17.3.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 460 of 862 rej09b0429-0100 table 17.3 i 2 c bus transfer rate (1) ? tcss = 0 stcr/ icmr iicx3 bit 5 bit 4 bit 3 transfer rate iicxn cks2 cks1 cks0 clock = 20 mhz = 25 mhz = 34 mhz 0 0 0 0 /28 714.3 khz * 892.9 khz * 1214.3 khz * 1 /40 500.0 khz * 625.0 khz * 850.0 khz * 1 0 /48 416.7 khz * 520.8 khz * 708.3 khz * 1 /64 312.5 khz 390.6 khz 531.3 khz * 1 0 0 /80 250.0 khz 312.5 khz 425.0 khz * 1 /100 200.0 khz 250.0 khz 340.0 khz 1 0 /112 178.6 khz 223.2 khz 303.6 khz 1 /128 156.3 khz 195.3 khz 265.6 khz 1 0 0 0 /56 357.1 khz 446.4 khz * 607.1 khz * 1 /80 250.0 khz 312.5 khz 425.0 khz * 1 0 /96 208.3 khz 260.4 khz 354.2 khz 1 /128 156.3 khz 195.3 khz 265.6 khz 1 0 0 /160 125.0 khz 156.3 khz 212.5 khz 1 /200 100.0 khz 125.0 khz 170.0 khz 1 0 /224 89.3 khz 111.6 khz 151.8 khz 1 /256 78.1 khz 97.7 khz 132.8 khz note: * the correct operation cannot be guar anteed since the value is outside the i 2 c bus interface specifications (hig h-speed mode: max. 400 khz). (n = 0 to 5)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 461 of 862 rej09b0429-0100 table 17.3 i 2 c bus transfer rate (2) ? tcss = 1 stcr/ icmr iicx3 bit 5 bit 4 bit 3 transfer rate iicxn cks2 cks1 cks0 clock = 20 mhz = 25 mhz = 34 mhz 0 0 0 0 /56 357.1 khz 446.4 khz * 607.1 khz * 1 /80 250.0 khz 312.5 khz 425.0 khz * 1 0 /96 208.3 khz 260.4 khz 345.2 khz 1 /128 156.3 khz 195.3 khz 265.6 khz 1 0 0 /160 125.0 khz 156.3 khz 212.5 khz 1 /200 100.0 khz 125.0 khz 170.0 khz 1 0 /224 89.3 khz 111.6 khz 151.8 khz 1 /256 78.1 khz 97.7 khz 132.8 khz 1 0 0 0 /112 178.6 khz 223.2 khz 303.6 khz 1 /160 125.0 khz 156.3 khz 212.5 khz 1 0 /190 104.2 khz 130.2 khz 177.1 khz 1 /256 78.1 khz 97.7 khz 132.8 khz 1 0 0 /320 62.5 khz 78.1 khz 106.3 khz 1 /400 50.0 khz 62.5 khz 85.0 khz 1 0 /448 44.6 khz 55.8 khz 75.9 khz 1 /512 39.1 khz 48.8 khz 66.4 khz note: * the correct operation cannot be guar anteed since the value is outside the i 2 c bus interface specifications (hig h-speed mode: max. 400 khz). (n = 0 to 5)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 462 of 862 rej09b0429-0100 17.3.6 i 2 c bus control register (iccr) iccr controls the i 2 c bus interface and performs in terrupt flag confirmation. bit bit name initial value r/w description 7 ice 0 r/w i 2 c bus interface enable 0: i 2 c bus interface modules are stopped and i 2 c bus interface module internal state is initialized. sar and sarx can be accessed. 1: i 2 c bus interface modules can perform transfer and reception, they are connected to the scl and sda pins, and the i 2 c bus can be driven. icmr and icdr can be accessed. 6 ieic 0 r/w i 2 c bus interface interrupt enable 0: disables interrupts from the i 2 c bus interface to the cpu. 1: enables interrupts from the i 2 c bus interface to the cpu. 5 4 mst trs 0 0 r/w r/w master/slave select transmit/receive select 00: slave receive mode 01: slave transmit mode 10: master receive mode 11: master transmit mode both these bits will be cleared by hardware when they lose in a bus contention in master mode of the i 2 c bus format. in slave receive mode with i 2 c bus format, the r/ w bit in the first frame immediately after the start condition automatically sets these bits in receive mode or transmit mode by hardware. modification of the trs bit during transfer is deferred until transfer is completed, and the changeover is made after completion of the transfer.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 463 of 862 rej09b0429-0100 bit bit name initial value r/w description 5 4 mst trs 0 0 r/w r/w [mst clearing conditions] (1) when 0 is written by software (2) when lost in bus contention in i 2 c bus format master mode [mst setting conditions] (1) when 1 is written by software (for mst clearing condition 1) (2) when 1 is written in mst after reading mst = 0 (for mst clearing condition 2) [trs clearing conditions] (1) when 0 is written by software (except for trs setting condition 3) (2) when 0 is written in trs after reading trs = 1 (for trs setting condition 3) (3) when lost in bus contention in i 2 c bus format master mode [trs setting conditions] (1) when 1 is written by software (except for trs clearing condition 3) (2) when 1 is written in trs after reading trs = 0 (for trs clearing condition 3) (3) when 1 is received as the r/ w bit after the first frame address matching in i 2 c bus format slave mode 3 acke 0 r/w acknowledge bit decision selection 0: the value of the acknowledge bit is ignored, and continuous transfer is per formed. the value of the received acknowledge bit is not indicated by the ackb bit in icsr, which is always 0. 1: if the acknowledge bit is 1, continuous transfer is halted. depending on the receiving device, the acknowledge bit may be significant, in indicating completion of processing of the received data, for instanc e, or may be fixed at 1 and have no significance.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 464 of 862 rej09b0429-0100 bit bit name initial value r/w description 2 0 bbsy scp 0 1 r/w * w bus busy start condition/stop condition prohibit in master mode ? writing 0 in bbsy and 0 in scp: a stop condition is issued ? writing 1 in bbsy and 0 in scp: a start condition and a restart condition are issued in slave mode ? writing to the bbsy flag is disabled. [bbsy setting condition] ? when the sda level changes from high to low under the condition of scl = high, assuming that the start condition has been issued. [bbsy clearing conditions] ? when the sda level changes from low to high under the condition of scl = hi gh, assuming that the stop condition has been issued. to issue a start/stop condition, use the mov instruction. the i 2 c bus interface must be set in master transmit mode before the issue of a start condition. set mst to 1 and trs to 1 before writing 1 in bbsy and 0 in scp. the bbsy flag can be read to check whether the i 2 c bus (scl, sda) is busy or free. note: * even if the bbsy bit is written to, t he value of the flag does not change.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 465 of 862 rej09b0429-0100 bit bit name initial value r/w description 1 iric 0 r/(w) * i 2 c bus interface interrupt request flag indicates that the i 2 c bus interface has issued an interrupt request to the cpu. iric is set at different times depending on the fs bit in sar and the wait bit in icmr. see section 17.4.7, iric setting timing and scl control. the conditions under which iric is set also differ depending on the setting of the acke bit in iccr. [setting conditions] i 2 c bus format master mode: ? when a start condition is detected in the bus line state after a start condition is issued (when the icdre flag is set to 1 because of first frame transmission) ? when a wait is inserted between the data and acknowledge bit when the wait bit is 1 (fall of the 8th transmit/receive clock) ? at the end of data transfer (rise of the 9th transmit/receive clock) ? when a slave address is received after bus mastership is lost ? if 1 is received as the acknowledge bit (when the ackb bit in icsr is set to 1) when the acke bit is 1 ? when the al flag is set to 1 after bus mastership is lost while the alie bit is 1 i 2 c bus format slave mode: ? when the slave address (sva or svax) matches (when the aas or aasx flag in icsr is set to 1) and at the end of data transfer up to the subsequent retransmission start condition or stop condition detection (rise of the 9th clock) ? when the general call addres s is detected (when the 0 is received for r/ w bit, and adz flag in icsr is set to 1) and at the end of data rec eption up to the subsequent retransmission start condition or stop condition detection (rise of the 9th receive clock) ? when 1 is received as an acknowledge bit while the acke bit is 1 (when the ackb bit is set to 1) ? when a stop condition is detected while the stopim bit is 0 (when the stop or estp flag in icsr is set to 1)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 466 of 862 rej09b0429-0100 bit bit name initial value r/w description 1 iric 0 r/(w) * 1 at the end of data transfer in clock synchronous serial format (rise of the 8th transmit/receive clock) when a start condition is detected with serial format selected when a condition occurs in which the icdre or icdrf flag is set to 1. ? when a start condition is detected in transmit mode (when a start condition is detected and the icdre flag is set to 1) ? when transmitting the data in the icdr register buffer (when data is transferred from icdrt to icdrs in transmit mode and the icdre flag is set to 1, or data is transferred from icdrs to icdrr in receive mode and the icdrf flag is set to 1.) [clearing conditions] ? when 0 is written in iric after reading iric = 1 ? when icdr is accessed by dtc * (this may not be a clearing condition. for details, see the description of the dtc operation on the next page. note: * only 0 can be written to clear the flag.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 467 of 862 rej09b0429-0100 when the dtc is used, iric is cleared automatica lly and transfer can be performed continuously without cpu intervention. when, with the i 2 c bus format selected, iric is set to 1 an d an interrupt is generated, other flags must be checked in order to identify the source th at set iric to 1. although each source has a corresponding flag, cau tion is needed at the end of a transfer. when the icdre or icdrf flag is set, the irtr fl ag may or may not be set. the irtr flag (the dtc start request flag) is not set at the end of a data transfer up to detection of a retransmission start condition or stop condition after a slave ad dress (sva) or general call address match in i 2 c bus format slave mode. even when the iric flag and irtr flag are set, the icdre or icdrf flag may not be set. the iric and irtr flags are not cleared at the end of the specified number of transfers in continuous transfer using the dtc. the icdre or icdrf flag is clear ed, however, since the specified number of icdr reads or writes have been completed. tables 17.4 and 17.5 show the relationship between the flags and the transfer states.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 468 of 862 rej09b0429-0100 table 17.4 flags and transfer states (master mode) mst trs bbsy estp stop irtr aasx al aas adz ackb icdrf icdre state 1 1 0 0 0 0 0 0 0 0 0 ? 0 idle state (flag clearing required) 1 1 1 0 0 1 0 0 0 0 0 ? 1 start condition detected 1 ? 1 0 0 ? 0 0 0 0 ? ? ? wait state 1 1 1 0 0 ? 0 0 0 0 1 ? ? transmission end (acke=1 and ackb=1) 1 1 1 0 0 1 0 0 0 0 0 ? 1 transmission end with icdre=0 1 1 1 0 0 ? 0 0 0 0 0 ? 0 icdr write with the above state 1 1 1 0 0 ? 0 0 0 0 0 ? 1 transmission end with icdre=1 1 1 1 0 0 ? 0 0 0 0 0 ? 0 icdr write with the above state or after start condition detected 1 1 1 0 0 1 0 0 0 0 0 ? 1 automatic data transfer from icdrt to icdrs with the above state 1 0 1 0 0 1 0 0 0 0 ? 1 ? reception end with icdrf=0 1 0 1 0 0 ? 0 0 0 0 ? 0 ? icdr read with the above state 1 0 1 0 0 ? 0 0 0 0 ? 1 ? reception end with icdrf=1 1 0 1 0 0 ? 0 0 0 0 ? 0 ? icdr read with the above state 1 0 1 0 0 1 0 0 0 0 ? 1 ? automatic data transfer from icdrs to icdrr with the above state 0 0 1 0 0 ? 0 1 0 0 ? ? ? arbitration lost 1 ? 0 0 0 ? 0 0 0 0 ? ? 0 stop condition detected [legend] 0: 0-state retained 1: 1-state retained ? : previous state retained 0 : cleared to 0 1 : set to 1
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 469 of 862 rej09b0429-0100 table 17.5 flags and transfer states (slave mode) mst trs bbsy estp stop irtr aasx al aas adz ackb icdrf icdre state 0 0 0 0 0 0 0 0 0 0 0 ? 0 idle state (flag clearing required) 0 0 1 0 0 0 0 0 0 0 0 ? 1 start condition detected 0 1 /0 * 1 1 0 0 0 0 ? 1 0 0 1 1 sar match in first frame (sarx sar) 0 0 1 0 0 0 0 ? 1 1 0 1 1 general call address match in first frame (sarx h'00) 0 1 /0 * 1 1 0 0 1 1 ? 0 0 0 1 1 sar match in first frame (sar sarx) 0 1 1 0 0 ? ? ? ? 0 1 ? ? transmission end (acke=1 and ackb=1) 0 1 1 0 0 1 /0 * 1 ? ? ? 0 0 ? 1 transmission end with icdre=0 0 1 1 0 0 ? ? 0 0 0 0 ? 0 icdr write with the above state 0 1 1 0 0 ? ? ? ? 0 0 ? 1 transmission end with icdre=1 0 1 1 0 0 ? ? 0 0 0 0 ? 0 icdr write with the above state 0 1 1 0 0 1 /0 * 2 ? 0 0 0 0 ? 1 automatic data transfer from icdrt to icdrs with the above state 0 0 1 0 0 1 /0 * 2 ? ? ? ? ? 1 ? reception end with icdrf=0 0 0 1 0 0 ? ? 0 0 0 ? 0 ? icdr read with the above state
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 470 of 862 rej09b0429-0100 mst trs bbsy estp stop irtr aasx al aas adz ackb icdrf icdre state 0 0 1 0 0 ? ? ? ? ? ? 1 ? reception end with icdrf=1 0 0 1 0 0 ? ? 0 0 0 ? 0 ? icdr read with the above state 0 0 1 0 0 1 /0 * 2 ? 0 0 0 ? 1 ? automatic data transfer from icdrs to icdrr with the above state 0 ? 0 1 /0 * 3 0/1 * 3 ? ? ? ? ? ? ? 0 stop condition detected [legend] 0: 0-state retained 1: 1-state retained ? : previous state retained 0 : cleared to 0 1 : set to 1 notes: 1. set to 1 when 1 is received as a r/ w bit following an address. 2. set to 1 when the aasx bit is set to 1. 3. when estp=1, stop is 0, or when stop=1, estp is 0.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 471 of 862 rej09b0429-0100 17.3.7 i 2 c bus status register (icsr) icsr consists of status flags. refer to tables 17.4 and 17.5 as well. bit bit name initial value r/w description 7 estp 0 r/(w) * error stop condition detection flag this bit is valid in i 2 c bus format slave mode. [setting condition] when a stop condition is detected during frame transfer. [clearing conditions] ? when 0 is written in estp after reading estp = 1 ? when the iric flag in iccr is cleared to 0 6 stop 0 r/(w) * normal stop condition detection flag this bit is valid in i 2 c bus format slave mode. [setting condition] when a stop condition is detected after frame transfer is completed. [clearing conditions] ? when 0 is written in stop after reading stop = 1 ? when the iric flag is cleared to 0 5 irtr 0 r/(w) * i 2 c bus interface continuous transfer interrupt request flag indicates that the i 2 c bus interface has issued an interrupt request to the cpu, and the source is completion of reception/transmission of one frame in continuous transmission/reception for which dtc activation is possible. when the irtr flag is set to 1, the iric flag is also set to 1 at the same time. [setting conditions] i 2 c bus format slave mode: ? when the icdre or icdrf flag in icdr is set to 1 when aasx = 1 i 2 c bus format master mode or clocked synchronous serial format mode: ? when the icdre or icdrf flag is set to 1 [clearing conditions] ? when 0 is written after reading irtr = 1 ? when the iric flag is cleared to 0 while ice is 1
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 472 of 862 rej09b0429-0100 bit bit name initial value r/w description 4 aasx 0 r/(w) * second slave address recognition flag in i 2 c bus format slave receive mode, this flag is set to 1 if the first frame following a start condition matches bits svax6 to svax0 in sarx. [setting condition] when the second slave address is detected in slave receive mode and fsx = 0 in sarx [clearing conditions] ? when 0 is written in aasx after reading aasx = 1 ? when a start condition is detected ? in master mode 3 al 0 r/(w) * arbitration lost flag indicates that arbitration was lost in master mode. [setting conditions] when alsl=0 ? if the internal sda and sda pin disagree at the rise of scl in master transmit mode ? if the internal scl line is high at the fall of scl in master mode when alsl=1 ? if the internal sda and sda pin disagree at the rise of scl in master transmit mode ? if the sda pin is driven low by another device before the i 2 c bus interface drives the sda pin low, after the start condition instruction was executed in master transmit mode [clearing conditions] ? when icdr is written to (transmit mode) or read from (receive mode) ? when 0 is written in al after reading al = 1
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 473 of 862 rej09b0429-0100 bit bit name initial value r/w description 2 aas 0 r/(w) * slave address recognition flag in i 2 c bus format slave receive mode, this flag is set to 1 if the first frame following a start condition matches bits sva6 to sva0 in sar, or if the general call address (h'00) is detected. [setting condition] when the slave address or general call address (one frame including a r/ w bit is h'00) is detected in slave receive mode and fs = 0 in sar [clearing conditions] ? when icdr is written to (transmit mode) or read from (receive mode) ? when 0 is written in aas after reading aas = 1 ? in master mode 1 adz 0 r/(w) * general call address recognition flag in i 2 c bus format slave receive mode, this flag is set to 1 if the first frame following a start condition is the general call address (h'00). [setting condition] when the general call address (one frame including a r/ w bit is h'00) is detected in slave receive mode and fs = 0 or fsx = 0 [clearing conditions] ? when icdr is written to (transmit mode) or read from (receive mode) ? when 0 is written in adz after reading adz = 1 ? in master mode if a general call address is detected while fs=1 and fsx=0, the adz flag is set to 1; however, the general call address is not recognized (aas flag is not set to 1).
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 474 of 862 rej09b0429-0100 bit bit name initial value r/w description 0 ackb 0 r/w acknowledge bit stores acknowledge data. transmit mode: [setting condition] when 1 is received as the acknowledge bit when acke=1 in transmit mode [clearing conditions] ? when 0 is received as the acknowledge bit when acke=1 in transmit mode ? when 0 is written to the acke bit receive mode: 0: returns 0 as acknowledge data after data reception 1: returns 1 as acknowledge data after data reception when this bit is read, the value loaded from the bus line (returned by the receiving device) is read in transmission (when trs = 1). in reception (when trs = 0), the value set by internal software is read. when this bit is written, acknowledge data that is returned after receiving is rewritten re gardless of the trs value. if the icsr register bit is written using bit-manipulation instructions, the acknowledge data should be re-set since the acknowledge data setting is rewritten by the ackb bit reading value. write the acke bit to 0 to clear the ackb flag to 0, before transmission is ended and a stop condition is issued in master mode, or before transmission is ended and sda is released to issue a stop condition by a master device. note: * only 0 can be written to clear the flag.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 475 of 862 rej09b0429-0100 17.3.8 i 2 c bus extended control register (icxr) icxr enables or disables the i 2 c bus interface interrupt genera tion and continuous receive operation, and indicates the status of receive/transmit operations. bit bit name initial value r/w description 7 stopim 0 r/w stop condition interrupt source mask enables or disables the interrupt generation when the stop condition is detected in slave mode. 0: enables iric flag setting and interrupt generation when the stop condition is detecte d (stop = 1 or estp = 1) in slave mode. 1: disables iric flag setting and interrupt generation when the stop condition is detected. 6 hnds 0 r/w handshake receive operation select enables or disables continuous receive operation in receive mode. 0: enables continuous receive operation 1: disables continuous receive operation when the hnds bit is cleared to 0, receive operation is performed continuously after data has been received successfully while icdrf flag is 0. when the hnds bit is set to 1, scl is fixed to the low level after data has been received successfully while icdrf flag is 0; thus disabling the next data to be transferred. the bus line is released and next receive operation is enabled by reading the receive data in icdr.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 476 of 862 rej09b0429-0100 bit bit name initial value r/w description 5 icdrf 0 r receive data read request flag indicates the icdr (icdrr) st atus in receive mode. 0: indicates that the data has been already read from icdr (icdrr) or icdr is initialized. 1: indicates that data has been received successfully and transferred from icdrs to icdrr, and the data is ready to be read out. [setting conditions] ? when data is received successfully and transferred from icdrs to icdrr. (1) when data is received successfully while icdrf = 0 (at the rise of the 9th clock pulse). (2) when icdr is read successfully in receive mode after data was received while icdrf = 1. [clearing conditions] ? when icdr (icdrr) is read. ? when 0 is written to the ice bit. when icdrf is set due to the condition (2) above, icdrf is temporarily cleared to 0 when icdr (icdrr) is read; however, since data is transferred from icdrs to icdrr immediately, icdrf is set to 1 again. note that icdr cannot be read successfully in transmit mode (trs = 1) because data is not transferred from icdrs to icdrr. be sure to read data from icdr in receive mode (trs = 0).
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 477 of 862 rej09b0429-0100 bit bit name initial value r/w description 4 icdre 0 r transmit data write request flag indicates the icdr (icdrt) st atus in transmit mode. 0: indicates that the data has been already written to icdr (icdrt) or icdr is initialized. 1: indicates that data has been transferred from icdrt to icdrs and is being transmitted, or the start condition has been detected or transmission has been completed, thus allowing the next data to be written to. [setting conditions] ? when the start condition is detected from the bus line state in i 2 c bus format or serial format. ? when data is transferred from icdrt to icdrs. 1. when data is transmitted completely while icdre = 0 (at the rise of the 9th clock pulse). 2. when data is written to icdr completely in transmit mode after data was transmitted while icdre = 1. [clearing conditions] ? when data is written to icdr (icdrt). ? when the stop condition is detected in i 2 c bus format or serial format. ? when 0 is written to the ice bit. note that if the acke bit is set to 1 in i 2 c bus format thus enabling acknowledge bit decision, icdre is not set when data is transmitted completely while the acknowledge bit is 1. when icdre is set due to the condition (2) above, icdre is temporarily cleared to 0 when data is written to icdr (icdrt); however, since data is transferred from icdrt to icdrs immediately, icdrf is set to 1 again. do not write data to icdr when trs = 0 because the icdre flag value is invalid during the time.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 478 of 862 rej09b0429-0100 bit bit name initial value r/w description 3 alie 0 r/w arbitration lost interrupt enable enables or disables iric flag setting and interrupt request when arbitration is lost. 0: disables interrupt request when arbitration is lost. 1: enables interrupt request when arbitration is lost. 2 alsl 0 r/w arbitration lost condition select selects the condition under which arbitration is lost. 0: if the sda pin state dis agrees with the data that i 2 c bus interface outputs at the rise of scl and the scl pin is driven low by another device. 1: if the sda pin state dis agrees with the data that i 2 c bus interface outputs at the rise of scl and the sda line is driven low by another device in idle state or after the start condition instruction was executed. 1 0 fnc1 fnc0 0 0 r/w r/w function bit these bits cancel some restrictions on usage. for details, refer to section 17.6, usage notes. 00: restrictions on operation remaining in effect 01: setting prohibited 10: setting prohibited 11: restrictions on operation canceled
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 479 of 862 rej09b0429-0100 17.3.9 i 2 c smbus control register (icsmbcr) icsmbcr is used to support the system management bus (smbus) specifications. to support the smbus specification, sda output data hold time should be specified in the range of 300 ns to 1000 ns. table 17.6 shows the relationship between the icsmbcr setting and output data hold time. when the smbus is not supported, the initial value should not be changed. icsmbcr is enabled to access when bit mstp4 is cleared to 0. bit bit name initial value r/w description 7 6 5 4 3 2 smb5e smb4e smb3e smb2e smb1e smb0e 0 0 0 0 0 00 r/w r/w r/w r/w r/w r/w smbus enable these bits enable/disable to support the smbus, in combination with bits fsel1 and fsel0. bits smb5e, smb4e, smb3e, smb2e, smb1e, and smb0e control iic_5, iic_4, iic_3, iic_2, iic_1, and iic_0, respectively. 0: disables to support the smbus 1: enables to support the smbus 1 0 fsel1 fsel0 0 0 r/w r/w frequency selection these bits must be specifie d to match the system clock frequency in order to support the smbus. for details of the setting, see table 17.7.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 480 of 862 rej09b0429-0100 table 17.6 output data hold time output data hold time (ns) smbne fsel1 fsel0 min./max. = 20 mhz = 25 mhz = 34 mhz 0 ? ? min. 100 * 80 * 59 * max. 150 * 120 * 88 * 1 0 0 min. 150 * 120 * 88 * max. 250 * 200 * 147 * 1 min. 200 * 160 * 118 * max. 350 280 * 206 * 1 0 min. 300 240 * 176 * max. 550 440 324 1 min. 500 400 294 * max. 950 760 559 notes: n = 0 to 5 * since the value is outside the smbus specification, it should not be set. table 17.7 iscmbcr setting system clock smbne fsel1 fsel0 20 mhz 1 1 0 20 to 34 mhz 1 1 1 n = 0 to 5
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 481 of 862 rej09b0429-0100 17.4 operation 17.4.1 i 2 c bus data format the i 2 c bus interface has an i 2 c bus format and a serial format. the i 2 c bus formats are addressing formats with an acknowledge bit. these are shown in figures 17.3 (a) and (b). the first frame following a start condition always consists of 9 bits. the serial format is a non-addressing format with no acknowledge bit. this is shown in figure 17.4. figure 17.5 shows the i 2 c bus timing. the symbols used in figures 17.3 to 17.5 are explained in table 17.8. sa sla 7n r/ w data a 1 1m 11 1 a/ a 1 p 1 transfer bit count (n = 1 to 8) transfer frame count (m = from 1) s sla 7n1 7 r/ w adata 11 1m1 1 a/ a 1 s 1 sla r/ w 1 1m2 a 1 data n2 a/ a 1 p 1 (a) fs = 0 or fsx = 0 (b) start condition retransmission fs = 0 or fsx = 0 upper row: transfer bit count (n1, n2 = 1 to 8) lower row: transfer frame count (m1, m2 = from 1) figure 17.3 i 2 c bus data formats (i 2 c bus formats) s data 8n data 1 1m p 1 fs=1 and fsx=1 transfer bit count (n = 1 to 8) transfer frame count (m = from 1) figure 17.4 i 2 c bus data formats (serial formats)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 482 of 862 rej09b0429-0100 sda scl s sla r/ w a 9 8 1?7 9 8 1?7 9 8 1?7 data a data a/ a p figure 17.5 i 2 c bus timing table 17.8 i 2 c bus data format symbols symbol description s start condition. the master device drives sda from high to low while scl is high sla slave address. the master de vice selects the slave device. r/ w indicates the direction of data transfer: from the slave device to the master device when r/ w is 1, or from the master device to the slave device when r/w is 0 a acknowledge. the receiving device drives sda low to acknowledge a transfer. (the slave device returns acknowledge in master transmit mode, and the master device returns acknowledge in master receive mode.) data transferred data. the bit length of transfe rred data is set with the bc2 to bc0 bits in icmr. the msb first or lsb first is switched with the mls bit in icmr. p stop condition. the master device drives sda from low to high while scl is high
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 483 of 862 rej09b0429-0100 17.4.2 initialization initialize the iic by the procedure shown in figure 17.6 before starting transmission/reception of data. start initialization set mstp4 = 0 (iic_0) mstp3 = 0 (iic_1) mstp2 = 0 (iic_2, iic_3) mstp0 = 0 (iic_4, iic_5) (mstpcrl) set ice = 0 in iccr set icsr set stcr and iicx3 cancel module stop mode set the first and second slave addresses and iic communication format (sva6 to sva0, fs, svax6 to svax0, and fsx) enable icmr and icdr to be accessed use scl/sda pin as an iic port set transfer rate (iicx and tcss) enable the cpu accessing to the iic control register and data register set communication format, wait insertion, and transfer rate (mls, wait, cks2 to cks0) enable interrupt (stopim, hnds, alie, alsl, fnc1, and fnc0) set acknowledge bit (ackb) set icmr set iccr set iice = 1 in stcr set sar and sarx set ice = 1 in iccr set icxr << start transmit/receive operation >> set interrupt enable, transfer mode, and acknowledge decision (ieic, mst, trs, and acke) enable sar and sarx to be accessed figure 17.6 sample flowchart for iic initialization note: be sure to modify the icmr register afte r transmit/receive operation has been completed. if the icmr register is modi fied during transmit/receive operation, bit counter bc2 to bc0 will be modified erroneously, thus causing incorrect operation. 17.4.3 master transmit operation in i 2 c bus format master transmit mode, the master device outputs the transmit clock and transmit data, and the slave device returns an acknowledge signal.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 484 of 862 rej09b0429-0100 figure 17.7 shows the sample flowchart for the operations in master transmit mode. start initialize iic set mst = 1 and trs = 1 in iccr set bbsy =1 and scp = 0 in iccr write transmit data in icdr clear iric in iccr no no yes yes yes yes no no [1] initialization [3] select master transmit mode. [4] start condition issuance [6] set transmit data for the first byte (slave address + r/ w ). (after writing to icdr, clear iric continuously.) [9] set transmit data for the second and subsequent bytes. (after writing to icdr, clear iric immediately.) [2] test the status of the scl and sda lines. [7] wait for 1 byte to be transmitted. [10] wait for 1 byte to be transmitted. [11] determine end of transfer [12] stop condition issuance [8] test the acknowledge bit transferred from the slave device. [5] wait for a start condition generation read iric in iccr read ackb in icsr iric = 1? ackb = 0? transmit mode? write transmit data in icdr clear iric in iccr read iric in iccr read ackb in icsr clear iric in iccr end of transmission? (ackb = 1?) set bbsy = 0 and scp = 0 in iccr end read bbsy in iccr bbsy = 0? yes no read iric in iccr iric = 1? yes no yes no iric = 1? master receive mode figure 17.7 sample flowchart for operations in master transmit mode
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 485 of 862 rej09b0429-0100 the transmission procedure and operations by which data is sequentially transmitted in synchronization with icdr (icdrt) wr ite operations, are described below. 1. initialize the iic as described in section 17.4.2, initialization. 2. read the bbsy flag in iccr to confirm that the bus is free. 3. set bits mst and trs to 1 in i ccr to select master transmit mode. 4. write 1 to bbsy and 0 to scp in iccr. this changes sda from high to low when scl is high, and generates the start condition. 5. then the iric and irtr flags are set to 1. if the ieic bit in iccr has been set to 1, an interrupt request is sent to the cpu. 6. write the data (slave address + r/ w ) to icdr. with the i 2 c bus format (when the fs bit in sar or th e fsx bit in sarx is 0), the first frame data following the start condition indicates the 7-bit slave addres s and transmit/receive direction (r/ w ). to determine the end of the transfer, the iric flag is cleared to 0. after writing to icdr, clear iric continuously so no other interrupt handling routine is executed. if the time for transmission of one frame of data has passed before the iric clearing, the end of transmission cannot be determined. the master device sequen tially sends the transmission clock and the data written to icdr. the selected slave device (i.e. the slave device with the matching slave address) drives sda low at the 9th transmit clock pulse and returns an acknowledge signal. 7. when one frame of data has been transmitted, the iric flag is set to 1 at the rise of the 9th transmit clock pulse. after one frame has been transmitted, scl is automatically fixed low in synchronization with the internal clock until the next transmit data is written. 8. read the ackb bit in icsr to confirm that ac kb is cleared to 0. when the slave device has not acknowledged (ackb bit is 1), operate st ep [12] to end transmission, and retry the transmit operation. 9. write the transmit data to icdr. as indicating the end of the transfer, the iric fl ag is cleared to 0. perform the icdr write and the iric flag clearing sequentially, just as in step [6]. transmission of the next frame is performed in synchronization with the internal clock. 10. when one frame of data has been transmitted, the iric flag is set to 1 at the rise of the 9th transmit clock pulse. after one frame has been transmitted, scl is automatically fixed low in synchronization with the internal clock until the next transmit data is written. 11. read the ackb bit in icsr. confirm that the slave device has been acknowledged (ackb bit is 0). when there is still data to be transmitted, go to step [9] to continue the next transmission operation. when the slave device has not acknowledged (ackb bit is set to 1), operate step [12] to end transmission.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 486 of 862 rej09b0429-0100 12. clear the iric flag to 0. write 0 to acke in iccr, to clear received ac kb contents to 0. write 0 to bbsy and scp in iccr. this changes sda from low to high when scl is high, and generates the stop condition. sda (master output) sda (slave output) 2 1 r/ w 4 36 58 7 12 9 a bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 icdre irtr icdrt note: do not set icdr during this period. scl (master output) start condition generation slave address data 1 data 1 [9] icdr write [9] iric clear [6] icdr write [6] iric clear [4] bbsy set to 1 and scp cleared to 0 (start condition issuance) user processing interrupt request interrupt request address + r/ w iric [7] [5] icdrs data 1 address + r/ w figure 17.8 operation timing example in master transmit mode (mls = wait = 0)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 487 of 862 rej09b0429-0100 sda (master output) sda (slave output) 2 14 36 58 79 89 a bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 0 icdre irtr icdr scl (master output) stop condition issuance data 2 [9] icdr write [9] iric clear [12] iric clear [11] ackb read [12] bbsy set to 1 and scp cleared to 0 (stop condition issuance) iric a [10] [7] data 1 data 1 data 2 user processing figure 17.9 stop condition issuance operat ion timing example in master transmit mode (mls = wait = 0) 17.4.4 master receive operation in i 2 c bus format master receive mode, the master device outputs the receive clock, receives data, and returns an acknowledge signal. the slave device transmits data. the master device transmits data containing the slave address and r/ w (1: read) in the first frame following the start condition issuance in master transmit mode, selects the slave device, and then switches the mode for receive operation.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 488 of 862 rej09b0429-0100 receive operation using the hnds function (hnds = 1): figure 17.10 shows the sample flowchart for the operations in master receive mode (hnds = 1). end set trs = 0 in iccr set ackb = 1 in icsr read iric in iccr clear iric in iccr clear iric in iccr clear iric in iccr set hnds = 1 in icxr set bbsy = 0 and scp = 0 in iccr iric = 1? no yes yes read icdr no [4] clear iric. [1] select receive mode. [2] start receiving. the first read is a dummy read. [5] read the receive data (for the second and subsequent read) [3] wait for 1 byte to be received. (set iric at the rise of the 9th clock for the receive frame) [6] set acknowledge data for the last reception. [10] read the receive data. [9] clear iric. [7] read the receive data. dummy read to start receiving if the first frame is the last receive data. [11] set stop condition issuance. generate stop condition. master receive mode read iric in iccr iric = 1? no yes [8] wait for 1 byte to be received. set ackb = 0 in icsr last receive? read icdr read icdr set trs = 1 in iccr figure 17.10 sample flowchart for operat ions in master receive mode (hnds = 1)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 489 of 862 rej09b0429-0100 the reception procedure and operations by which the data reception process is provided in 1-byte units with scl fixed low at each data reception are described below. 1. clear the trs bit in i ccr to 0 to switch from transmit mode to receive mode. clear the ackb bit in icsr to 0 (acknowledge data setting). set the hnds bit in icxr to 1. clear the iric flag to 0 to de termine the end of reception. go to step [6] to halt reception operation if the first frame is the last receive data. 2. when icdr is read (dummy data read), recep tion is started, and the receive clock is output, and data received, in synchronization with the internal clock. (data from the sda pin is sequentially transferred to icdr s in synchronization with the rise of the receive clock pulses.) 3. the master device drives sda low to return the acknowledge data at the 9th receive clock pulse. the receive data is transferred to icdrr from icdrs at the rise of the 9th clock pulse, setting the icdrf, iric, and irtr flags to 1. if the ieic bit has been set to 1, an interrupt request is sent to the cpu. the master device drives scl low from the fall of the 9th receive clock pulse to the icdr data reading. 4. clear the iric flag to determine the next interrupt. go to step [6] to halt reception operation if the next frame is the last receive data. 5. read icdr receive data. this clears the ic drf flag to 0. the master device outputs the receive clock continuously to receive the next data. data can be received continuously by repeating steps [3] to [5]. 6. set the ackb bit to 1 so as to return the acknowledge data for the last reception. 7. read icdr receive data. this clears the ic drf flag to 0. the master device outputs the receive clock to receive data. 8. when one frame of data has been received, the icdrf, iric, and irtr flags are set to 1 at the rise of the 9th receive clock pulse. 9. clear the iric flag to 0. 10. read icdr receive data after setting the tr s bit. this clears the icdrf flag to 0. 11. clear the bbsy bit and scp bit to 0 in iccr. this changes sda from low to high when scl is high, and generates the stop condition.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 490 of 862 rej09b0429-0100 sda (master output) sda (slave output) 2 1 4 3 6 5 8 7 1 2 9 9 a a bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 irtr icdrf icdrr scl (master output) master transmit mode master receive mode data 1 data 1 data 2 [1] trs cleared to 0 [2] icdr read (dummy read) [1] iric clear scl is fixed low until icdr is read scl is fixed low until icdr is read [4] iric clear user processing iric [3] [6] icdr read (data 1) undefined value figure 17.11 master receive mo de operation timing example (mls = wait = 0, hnds = 1) sda (master output) sda (slave output) 2 1 4 3 6 5 8 7 9 9 78 a a bit 7 bit 1 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 iric icdrf icdrr scl (master output) data 3 data 2 data 1 data 2 data 3 [9] iric clear user processing irtr [8] [3] bit 0 [11] bbsy cleared to 0 and scp cleared to 0 (stop condition instruction issuance) [4] iric clear [7] icdr read (data 2) [10] icdr read (data 3) [6] ackb set to 1 bit 0 stop condition generation scl is fixed low until icdr is read scl is fixed low until icdr is read figure 17.12 stop condition issuance ti ming example in master receive mode (mls = wait = 0, hnds = 1)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 491 of 862 rej09b0429-0100 receive operation usin g the wait function: figures 17.13 and 17.14 s how the sample flowcharts for the op erations in master receive mode (wait = 1). set trs = 0 in iccr set ackb = 0 in icsr set wait = 1 in icmr yes yes yes clear iric in iccr clear iric in iccr read iric in iccr last receive? iric = 1? irtr = 1? yes irtr=1? no no no no read iric in iccr iric=1? no yes read icdr [4] determine end of reception [13] determine end of reception [1] select receive mode. [2] start receiving. the first read is a dummy read. [3] wait for a receive wait (set iric at the fall of the 8th clock) or, wait for 1 byte to be received (set iric at the rise of the 9th clock) [12] wait for a receive wait (set iric at the fall of the 8th clock) or, wait for 1 byte to be received (set iric at the rise of the 9th clock) [5] read the receive data. [6] clear iric. (to end the wait insertion) [15] clear wait mode. clear iric. ( iric should be cleared to 0 after setting wait = 0.) [17] generate stop condition master receive mode [14] clear iric. (to end the wait insertion) [16] read the last receive data. [7] set acknowledge data for the last reception. [8] wait for trs setting [9] set trs for stop condition issuance [10] read the receive data. [11] clear iric. read icdr clear iric in iccr set hnds = 0 in icxr wait for one clock pulse set ackb = 1 in icsr set trs = 1 in iccr end set wait = 0 in icmr set bbsy= 0 and scp= 0 in iccr clear iric in iccr read icdr clear iric in iccr read icdr figure 17.13 sample flowchart for operations in master receive mode (receiving multiple bytes) (wait = 1)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 492 of 862 rej09b0429-0100 end set hnds = 0 in icxr set wait = 0 in icmr set wait = 0 in icmr set ackb = 0 in icsr set ackb = 1 in icsr read icdr clear iric in iccr clear iric in iccr clear iric in iccr read iric in iccr read icdr read iric in iccr iric = 1? yes no no iric = 1? yes [1] select receive mode. [2] start receiving. the first read is a dummy read. [3] wait for a receive wait (set iric at the fall of the 8 th clock) [15] clear wait mode. clear iric. ( iric should be cleared to 0 after setting wait = 0.) [14] clear iric. (to end the wait insertion) [12] wait for 1 byte to be received. (set iric at the rise of the 9th clock) [9] set trs for stop condition issuance [7] set acknowledge data for the last reception. [16] read the last receive data master receive mode set trs = 0 in iccr set trs = 1 in iccr [17] generate stop condition set bbsy = 0 and scp = 0 in iccr figure 17.14 sample flowchart for operations in master receive mode (receiving a single byte) (wait = 1) the reception procedure and operations using the wait function (wait bit) , by which data is sequentially received in synchronization with icdr (icdrr) read operations, are described below. the following describes the multip le-byte reception procedure. in single-byte reception, some steps of the following procedure are omitted. at th is time, follow the procedure shown in figure 17.14
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 493 of 862 rej09b0429-0100 1. clear the trs bit in i ccr to 0 to switch from transmit mode to receive mode. clear the ackb bit in icsr to 0 to set the acknowledge data. clear the hnds bit in icxr to 0 to cancel the handshake function. clear the iric flag to 0, and then set the wait bit in icmr to 1. 2. when icdr is read (dummy data is read), r eception is started, and the receive clock is output, and data received, in synchroniza tion with the internal clock. 3. the iric flag is set to 1 in either of the following cases. if the ieic bit in iccr has been set to 1, an interrupt request is sent to the cpu. (1) at the fall of the 8th receive clock pulse for one frame scl is automatically fixed low in synchronization with the internal clock until the iric flag clearing. (2) at the rise of the 9th r eceive clock pulse for one frame the irtr and icdrf flags are set to 1, in dicating that one frame of data has been received. the master device outputs the receiv e clock continuously to receive the next data. 4. read the irtr flag in icsr. if the irtr flag is 0, execute st ep [6] to clear the iric flag to 0 to release the wait state. if the irtr flag is 1 and the next data is the last receive data, execute step [7] to halt reception. 5. if irtr flag is 1, read icdr receive data. 6. clear the iric flag. when the flag is set as (1) in step [3], the master device outputs the 9th clock and drives sda low at the 9th receive cl ock pulse to return an acknowledge signal. data can be received continuously by repeating steps [3] to [6]. 7. set the ackb bit in icsr to 1 so as to re turn the acknowledge data for the last reception. 8. after the iric flag is set to 1, wait for at least one clock pulse until the rise of the first clock pulse for the next receive data. 9. set the trs bit in iccr to 1 to switch from r eceive mode to transmit mode. the trs bit value becomes valid when the rising edge of the next 9th clock pulse is input. 10. read the icdr receive data. 11. clear the iric flag to 0.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 494 of 862 rej09b0429-0100 12. the iric flag is set to 1 in either of the following cases. (1) at the fall of the 8th receive clock pulse for one frame scl is automatically fixed low in synchronization with the internal clock until the iric flag is cleared. (2) at the rise of the 9th r eceive clock pulse for one frame the irtr and icdrf flags are set to 1, in dicating that one frame of data has been received. 13. read the irtr flag in icsr. if the irtr flag is 0, execute st ep [14] to clear the iric flag to 0 to release the wait state. if the irtr flag is 1 and data reception is co mplete, execute step [15] to issue the stop condition. 14. if irtr flag is 0, clear the iric flag to 0 to release the wait state. execute step [12] to read the iric flag to detect the end of reception. 15. clear the wait bit in icmr to cancel the wait mode. clearing of the iric flag should be done while wait = 0. (if the wait bit is cleared to 0 after clearing the iric flag and then an instruc tion to issue a stop condition is executed, the stop condition may not be issued correctly.) 16. read the last icdr receive data. 17. clear the bbsy bit and scp bit to 0 in iccr. this changes sda from low to high when scl is high, and generates the stop condition.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 495 of 862 rej09b0429-0100 sda (master output) sda (slave output) 2 1 2 1 4 36 58 79 bit 7 bit 6 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 iric irtr icdr scl (master output) data 1 [1] trs cleared to 0 iric clear to 0 [6] iric clear [5] icdr read (data 1) [6] iric clear (to end wait insertion) user processing bit 5 bit 4 bit 3 5 4 3 9 data 1 data 2 [3] [3] a [2] icdr read (dummy read) master transmit mode master receive mode a [4]irtr=0 [4] irtr=1 figure 17.15 master receive mo de operation timing example (mls = ackb = 0, wait = 1) sda (master output) sda (slave output) 2 1 4 3 6 5 8 7 9 9 8 a a bit 7 bit 0 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 iric irtr icdr scl (master output) data 3 data 2 data 1 data 2 data 3 [6] iric clear (to end wait insertion) [8] wait for one clock pulse [11] iric clear [14] iric clear (to end wait insertion) [16] icdr read (data 3) user processing [12] [3] [10] icdr read (data 2) [9] set trs=1 [7] set ackb=1 [15] wait cleared to 0, iric clear [17] stop condition issuance bit 0 stop condition generation [13] irtr=1 [13] irtr=0 [12] [4] irtr=1 [4] irtr=0 [3] figure 17.16 stop condition issuance ti ming example in master receive mode (mls = ackb = 0, wait = 1)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 496 of 862 rej09b0429-0100 17.4.5 slave receive operation in i 2 c bus format slave receive mode, the master device outputs the transmit clock and transmit data, and the slave device returns an acknowledge signal. the slave device operates as the device specified by the master device when the slave address in the first frame following the start condition that is issued by the master device matches its own address.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 497 of 862 rej09b0429-0100 receive operation using the hnds function (hnds = 1): figure 17.17 shows the sample fl owchart for the operat ions in slave receive mode (hnds = 1). slave receive mode read iric in iccr clear iric in iccr clear iric in iccr read aasx, aas and adz in icsr read trs in iccr read iric in iccr clear iric in iccr clear iric in iccr read icdr read icdr set ackb = 0 in icsr and hnds = 1 in icxr general call address processing * description omitted set mst = 0 and trs = 0 in iccr iric = 1? no yes read iric in iccr set ackb = 1 in icsr iric = 1? no no yes yes trs = 1? iric = 1? yes yes no yes no aas = 1 and adz = 1? [1] initialization. select slave receive mode. [2] read the receive data remaining unread. [3] to [7] wait for one byte to be received (slave address + r/ w ) [10] read the receive data. the first read is a dummy read. [9] set acknowledge data for the last reception. [8] clear iric [5] to [7] wait for the reception to end. [5] to [7] wait for the reception to end. or [11] detect stop condition slave transmit mode last reception? yes no no readicdr, clear iric no yes initialize iic icdrf = 1? [8] clear iric [12] check stop [8] clear iric [12] clear iric [10] read the receive data. end clear iric in iccr estp = 1 or stop = 1? figure 17.17 sample flowchart for operat ions in slave receive mode (hnds = 1)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 498 of 862 rej09b0429-0100 the reception procedure and operations using th e hnds bit function by which data reception process is provided in 1-byte unit with scl being fixed low at every data reception, are described below. 1. initialize the iic as described in section 17.4.2, initialization. clear the mst and trs bits to 0 to set slave receive mode, and set the hnds bit to 1 and the ackb bit to 0. clear the iric flag in iccr to 0 to see th e end of reception. 2. confirm that the icdrf flag is 0. if the icdrf flag is set to 1, read the icdr and then clear the iric flag to 0. 3. when the start condition output by the master device is detected, the bbsy flag in iccr is set to 1. the master device then outputs the 7-bit slave address, and transmit/receive direction (r/ w ), in synchronization with the transmit clock pulses. 4. when the slave address matches in the first frame following the start condition, the device operates as the slave device specified by th e master device. if the 8th data bit (r/ w ) is 0, the trs bit remains cleared to 0, and slave receive operation is performed. if the 8th data bit (r/ w ) is 1, the trs bit is set to 1, and slave transmit operation is performed. when the slave address does not ma tch, receive operation is halted until the next start condition is detected. 5. at the 9th clock pulse of the receive frame, the slave device re turns the data in the ackb bit as the acknowledge data. 6. at the rise of the 9th clock pulse, the iric flag is set to 1. if the ieic bit has been set to 1, an interrupt request is sent to the cpu. if the aasx bit has been set to 1, irtr flag is also set to 1. 7. at the rise of the 9th clock pulse, the recei ve data is transferred from icdrs to icdrr, setting the icdrf flag to 1. the slave device dr ives scl low from the fall of the 9th receive clock pulse until data is read from icdr. 8. confirm that the stop b it is cleared to 0, and clear the iric flag to 0. 9. if the next frame is the last recei ve frame, set the ackb bit to 1. 10. if icdr is read, the icdrf flag is cleared to 0, releasing the scl bus line. this enables the master device to transfer the next data. receive operations can be performed conti nuously by repeating steps [5] to [10]. 11. when the stop condition is detected (sda is changed from low to high when scl is high), the bbsy flag is cleared to 0 and the stop bi t is set to 1. if the stopim bit has been cleared to 0, the iric flag is set to 1. 12. confirm that the stop bit is set to 1, and clear the iric flag to 0.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 499 of 862 rej09b0429-0100 sda (master output) sda (slave output) 2 1 2 1 4 36 58 79 bit 7 bit 6 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 icdrf iric icdrs icdrr scl (master output) scl (slave output) address +r/ w address +r/ w undefined value [8] iric clear [10] icdr read (dummy read) user processing 2 1 2 1 4 36 58 79 scl (pin waveform) start condition generation slave address data 1 [6] a r/ w [7] scl is fixed low until icdr is read [2] icdr read interrupt request occurrence figure 17.18 slave receive mode operation timing example (1) (mls = 0, hnds= 1) sda (master output) sda (slave output) 2 14 36 58 79 89 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 0 iric icdrs icdrf icdrr data (n-1) scl (master output) scl (slave output) [8] iric clear [12] iric clear [9] set ackb=1 [10] icdr read ( data (n- 1)) [10] icdr read ( data (n )) user processing data (n ) data (n- 1) data (n-2 ) [6] [6] [11] a a stop condition generation [7] scl is fixed low until icdr is read [7] scl is fixed low until icdr is read data (n- 1) data (n ) data (n ) [8] iric clear figure 17.19 slave receive mode operation timing example (2) (mls = 0, hnds= 1)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 500 of 862 rej09b0429-0100 continuous receive operation: figure 17.20 shows the sample fl owchart for the opera tions in slave receive mode (hnds = 0). slave receive mode end read iric in iccr clear iric in iccr clear iric in iccr read aasx, aas and adz in icsr read trs in iccr read iric in iccr clear iric in iccr clear iric in iccr read icdr wait for one frame read icdr set ackb = 0 in icsr set ackb = 1 in icsr set hnds = 0 in icxr general call address processing * description omitted set mst = 0 and trs = 0 in iccr iric = 1? no yes icdrf = 1? yes trs = 1? iric = 1? icdrf = 1? yes yes no no yes no aas = 1 and adz = 1? no no [1] select slave receive mode. [2] read the receive data remaining unread. [3] to [7] wait for one byte to be received (slave address + r/ w ) (set iric at the rise of the 9th clock) [9] wait for ackb setting and set acknowledge data for the last reception (after the rise of the 9th clock of (n-1)th byte data) [15] clear iric [14] read the last receive data [8] clear iric [13] clear iric [10] read the receive data. the first read is a dummy read. [11] wait for one byte to be received (set iric at the rise of the 9th clock) [12] detect stop condition slave transmit mode yes no no read icdr no yes icdrf = 1? (n-2)th-byte reception? estp = 1 or stop = 1? * n: address + total number of bytes received clear iric in iccr figure 17.20 sample flowchart for operat ions in slave receive mode (hnds = 0)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 501 of 862 rej09b0429-0100 the reception procedure and operations in slave receive are described below. 1. initialize the iic as described in section 17.4.2, initialization. clear the mst and trs bits to 0 to set slave receive mode, and set the hnds and ackb bits to 0. clear the iric flag in iccr to 0 to see the en d of reception. 2. confirm that the icdrf flag is 0. if the icdrf flag is set to 1, read the icdr and then clear the iric flag to 0. 3. when the start condition output by the master device is detected, the bbsy flag in iccr is set to 1. the master device then outputs the 7-bit slave address, and transmit/receive direction (r/w) in synchronization with the transmit clock pulses. 4. when the slave address matches in the first frame following the start condition, the device operates as the slave device specified by th e master device. if the 8th data bit (r/ w ) is 0, the trs bit remains cleared to 0, and slave receive operation is performed. if the 8th data bit (r/ w ) is 1, the trs bit is set to 1, and slave transmit operation is performed. when the slave address does not ma tch, receive operation is halted until th e next start condition is detected. 5. at the 9th clock pulse of the receive frame, the slave device re turns the data in the ackb bit as the acknowledge data. 6. at the rise of the 9th clock pulse, the iric flag is set to 1. if the ieic bit has been set to 1, an interrupt request is sent to the cpu. if the aasx bit has been set to 1, the irtr flag is also set to 1. 7. at the rise of the 9th clock pulse, the recei ve data is transferred from icdrs to icdrr, setting the icdrf flag to 1. 8. confirm that the stop bit is cleared to 0 and clear the iric flag to 0. 9. if the next read data is the third last receive frame, wait for at least one frame time to set the ackb bit. set the ackb bit after the rise of the 9th clock pulse of the second last receive frame. 10. confirm that the icdrf flag is set to 1 an d read icdr. this clears the icdrf flag to 0. 11. at the rise of the 9th clock pulse or when the receive data is transferred from irdrs to icdrr due to icdr read operation, th e iric and icdrf flags are set to 1. 12. when the stop condition is detected (sda is changed from low to high when scl is high), the bbsy flag is cleared to 0 and the stop or estp flag is set to 1. if the stopim bit has been cleared to 0, the iric flag is set to 1. in this case, execute step 14 to read the last receive data. 13. clear the iric flag to 0.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 502 of 862 rej09b0429-0100 receive operations can be performed con tinuously by repeating steps 9 to 13. 14. confirm that the icdrf flag is set to 1, and read icdr. 15. clear the iric flag. sda (master output) sda (slave output) 2 14 32 14 3 6 58 79 bit 7 bit 6 bit 7 bit 6 bit 5 bit 4 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 icdrf icdrs icdrr iric scl (master output) start condition issuance address+r/ w data 1 address+r/ w [8] iric clear [10] icdr read user processing slave address [6] [7] a r/ w data 1 figure 17.21 slave receive mode operation timing example (1) (mls = ackb = 0, hnds = 0)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 503 of 862 rej09b0429-0100 stop condition detection sda (master output) sda (slave output) 2 14 36 5 2 14 36 58 79 8 79 89 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 1 bit 0 icdrf icdrs icdrr iric scl (master output) [9] set ackb = 1 [13] iric clear [10] icdr read (data (n-2)) [10] icdr read (data (n-1)) [13] iric clear [9] wait for one frame user processing bit 7 bit 0 bit 6 bit 5 bit 4 bit 3 bit 2 data (n) data (n-1) data (n-1) data (n-1) data (n-2) data (n-2) data (n) data (n) data (n-2) [11] [11] [11] [12] aa a [13] iric clear [14] icdr read (data (n)) [15] iric clear figure 17.22 slave receive mode operation timing example (2) (mls = ackb = 0, hnds = 0)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 504 of 862 rej09b0429-0100 17.4.6 slave transmit operation if the slave address matches to the address in the first frame (address reception frame) following the start condition detection when the 8th bit data (r/ w ) is 1 (read), the trs bit in iccr is automatically set to 1 and the mode changes to slave transmit mode. figure 17.23 shows the sample flowchart fo r the operations in slave transmit mode. end write transmit data in icdr clear iric in iccr clear iric in iccr clear acke to 0 in iccr (ackb=0 clear) clear iric in iccr read iric in iccr read ackb in icsr set trs = 0 in iccr read icdr read iric in iccr iric = 1? yes yes no no iric = 1? yes no [1], [2] if the slave address matches to the address in the first frame following the start condition detection and the r/ w bit is 1 in slave receive mode, the mode changes to slave transmit mode. [8] set slave receive mode. [6] clear iric in iccr [7] clear acknowledge bit data [9] dummy read (to release the scl line). [10] wait for stop condition [3], [5] set transmit data for the second and subsequent bytes. [3], [4] wait for 1 byte to be transmitted. [4] determine end of transfer. slave transmit mode end of transmission (ackb = 1)? clear iric in iccr figure 17.23 sample flowchart for slave transmit mode
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 505 of 862 rej09b0429-0100 in slave transmit mode, the slave device outputs th e transmit data, while the master device outputs the receive clock and returns an acknowledge si gnal. the transmission procedure and operations in slave transmit mode are described below. 1. initialize slave receive mode an d wait for slave address reception. 2. when the slave address matches in the first frame following detection of the start condition, the slave device drives sda low at the 9th cloc k pulse and returns an acknowledge signal. if the 8th data bit (r/ w ) is 1, the trs bit in iccr is set to 1, and the mode changes to slave transmit mode automatically. the iric flag is set to 1 at the rise of the 9th clock. if the ieic bit in iccr has been set to 1, an interrupt reque st is sent to the cpu. at the same time, the icdre flag is set to 1. the slave device drives scl low from the fall of the 9th transmit clock until icdr data is written, to disable the master device to output the next transfer clock. 3. after clearing the iric flag to 0, write data to icdr. at this time, the icdre flag is cleared to 0. the written data is transferre d to icdrs, and the icdre and iric flags are set to 1 again. the slave device sequentially sends the data written into icdrs in accordance with the clock output by the master device. the iric flag is cleared to 0 to detect the end of transmission. processing from the icdr register writing to the iric flag clearing should be performed continuously. prevent any other interrupt processing from being inserted. 4. the master device drives sda low at the 9th clock pulse, an d returns an acknowledge signal. as this acknowledge signal is stored in the ackb bit in icsr, this bit can be used to determine whether the transfer operation was performed successfully. when one frame of data has been transmitted, the iric flag in iccr is set to 1 at the rise of the 9th transmit clock pulse. when the icdre flag is 0, the data written into icdr is transferred to icdrs and the icdre and iric flags are set to 1 again. if the icdre flag has been set to 1, this slave device drives scl low from the fall of the 9th transmit clock until data is written to icdr. 5. to continue transmission, write the next data to be transmitted into icdr. the icdre flag is cleared to 0. the iric flag is cleared to 0 to detect the end of tran smission. processing from the icdr register writing to the iric flag clear ing should be performed continuously. prevent any other interrupt processing from being inserted. transmit operations can be performed continuously by repeating steps 4 and 5. 6. clear the iric flag to 0. 7. to end transmission, clear the acke bit in th e iccr register to 0, to clear the acknowledge bit stored in the ackb bit to 0. 8. clear the trs bit to 0 for the next ad dress reception, to set slave receive mode. 9. dummy-read icdr to rel ease scl on the slave side.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 506 of 862 rej09b0429-0100 10. when the stop condition is detected, that is, when sda is changed from low to high when scl is high, the bbsy flag in iccr is cleared to 0 an d the stop flag in icsr is set to 1. when the stopim bit in icxr is 0, the iric flag is set to 1. if the iric flag has been set, it is cleared to 0. sda (master output) sda (slave output) 2 1 2 1 4 36 58 79 9 8 bit 7 bit 6 bit 5 bit 7 bit 6 bit 4 bit 3 bit 2 bit 1 bit 0 icdre icdr iric scl (master output) slave receive mode slave transmit mode [3] icdr write user processing data 1 data 1 data 2 data 2 a r/ w a [4] [3] iric clear [3] iric clear [5] iric clear [5] icdr write [2] figure 17.24 slave transmit mode operation timing example (mls = 0)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 507 of 862 rej09b0429-0100 17.4.7 iric setting ti ming and scl control the interrupt request flag (iric) is set at differ ent times depending on the wait bit in icmr, the fs bit in sar, and the fsx bit in sarx. if the icdre or icdrf flag is set to 1, scl is automatically held low after one fr ame has been transferred; this ti ming is synchronized with the internal clock. figures 17.25 to 17.27 show the iric set timing and scl control. scl sda iric user processing clear iric 23 1 a 8 7 3 2 1 9 8 7 when wait = 0, and fs = 0 or fsx = 0 (i 2 c bus format, no wait) (a) data transfer ends with icdre=0 at transmission, or icdrf=0 at reception. (b) data transfer ends with icdre=1 at transmission, or icdrf=1 at reception. scl sda iric user processing clear iric clear iric write to icdr (transmit) or read from icdr (receive) 1 a 8 7 1 9 8 7 figure 17.25 iric setting timing and scl control (1)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 508 of 862 rej09b0429-0100 scl sda iric user processing clear iric 2 13 a 8 123 9 8 clear iric when wait = 1, and fs = 0 or fsx = 0 (i 2 c bus format, wait inserted) scl sda iric user processing clear iric write to icdr (transmit) or read from icdr (receive) 1 a 8 1 9 8 clear iric (a) data transfer ends with icdre=0 at transmission, or icdrf=0 at reception. (b) data transfer ends with icdre=1 at transmission, or icdrf=1 at reception. figure 17.26 iric setting timing and scl control (2)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 509 of 862 rej09b0429-0100 scl sda iric user processing clear iric 1 8 7 4 123 8 7 when fs = 1 and fsx = 1 (clocked synchronous serial format) (a) data transfer ends with icdre=0 at transmission, or icdrf=0 at reception. scl sda iric user processing clear iric clear iric write to icdr (transmit) or read from icdr (receive) 8 72 14 3 1 8 7 (b) data transfer ends with icdre=1 at transmission, or icdrf=1 at reception. figure 17.27 iric setting timing and scl control (3)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 510 of 862 rej09b0429-0100 17.4.8 operation using the dtc this lsi provides the dtc to allow continuous da ta transfer. the dtc is initiated when the irtr flag is set to 1, which is one of the two interrupt flags (irtr and iric). when the acke bit is 0, the icdre, iric, and irtr flags are set at th e end of data transmission regardless of the acknowledge bit value. when the acke bit is 1, th e icdre, iric, and irtr flags are set if data transmission is completed with the acknowledge bit value of 0, and when the acke bit is 1, only the iric flag is set if data transmission is completed with the acknowledge bit value of 1. when initiated, dtc transfers specified number of bytes, clears the icdre, iric, and irtr flags to 0. therefore, no interrupt is generated during continuous data transfer; however, if data transmission is completed with the acknowledge b it value of 1 when the acke bit is 1, dtc is not initiated, thus allowing an interrupt to be generated if enabled. the acknowledge bit may indicate sp ecific events such as completi on of receive data processing for some receiving devices, and for other receiving devices, the ackno wledge bit may be held to 1, indicating no specific events. the i 2 c bus format provides for selec tion of the slave device and transfer direction by means of the slave address and the r/ w bit, confirmation of reception with the ack nowledge bit, indication of the last frame, and so on. ther efore, continuous data transfer us ing the dtc must be carried out in conjunction with cpu processing by means of interrupts. table 17.9 shows some examples of processing us ing the dtc. these examples assume that the number of transfer data bytes is known in slave mode.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 511 of 862 rej09b0429-0100 table 17.9 examples of operation using the dtc item master transmit mode master receive mode slave transmit mode slave receive mode slave address + r/ w bit transmission/ reception transmission by dtc (icdr write) transmission by cpu (icdr write) reception by cpu (icdr read) reception by cpu (icdr read) dummy data read ? processing by cpu (icdr read) ? ? actual data transmission/ reception transmission by dtc (icdr write) reception by dtc (icdr read) transmission by dtc (icdr write) reception by dtc (icdr read) dummy data (h'ff) write ? ? processing by dtc (icdr write) ? last frame processing not necessary reception by cpu (icdr read) not necessary reception by cpu (icdr read) transfer request processing after last frame processing 1st time: clearing by cpu 2nd time: stop condition issuance by cpu not necessary automatic clearing on detection of stop condition during transmission of dummy data (h'ff) not necessary setting of number of dtc transfer data frames transmission: actual data count + 1 (+1 equivalent to slave address + r/ w bits) reception: actual data count transmission: actual data count + 1 (+1 equivalent to dummy data (h'ff)) reception: actual data count
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 512 of 862 rej09b0429-0100 17.4.9 noise canceler the logic levels at the scl and sda pins are routed through noise cancelers before being latched internally. figure 17.28 shows a bl ock diagram of the noise canceler. the noise canceler consists of two cascaded latc hes and a match detector. the scl (or sda) pin input signal is sampled on the system clock, but is not passed forward to the next circuit unless the outputs of both latches agree. if they do not agree, the previous value is held. system clock cycle sampling clock c dq latch c dq latch scl or sda input signal match detector internal scl or sda signal sampling clock figure 17.28 block di agram of noise canceler 17.4.10 initialization of internal state the iic has a function for forcible initialization of its internal state if a deadlock occurs during communication. initialization is executed in accordance with clearing ice bit. scope of initialization: the initialization executed by this function covers the following items: ? icdre and icdrf internal flags ? transmit/receive sequencer and in ternal operating clock counter ? internal latches for retaining the output state of the scl and sda pins (wait, clock, data output, etc.)
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 513 of 862 rej09b0429-0100 the following items are not initialized: ? actual register values (icdr, sar, sarx, icmr, iccr, icsr, icxr (other than icdre and icdrf)) ? internal latches used to retain register read information for setting/clearing flags in the icmr, iccr, and icsr registers ? the value of the icmr register bit counter (bc2 to bc0) ? generated interrupt sources (interrupt sources transferred to the interrupt controller) notes on initialization: ? interrupt flags and interrupt so urces are not cleared, and so fl ag clearing measures must be taken as necessary. ? basically, other register flags are not cleared e ither, and so flag clear ing measures must be taken as necessary. ? if a flag clearing setting is made during tran smission/reception, the iic module will stop transmitting/receiving at that point and the scl and sda pins will be released. when transmission/reception is started again, register initialization, etc., must be carried out as necessary to enable correct communication as a system. the value of the bbsy bit cannot be modified directly by this module clear function, but since the stop condition pin waveform is generated according to the state and release timing of the scl and sda pins, the bbsy bit may be cleared as a result. similarly, state switching of other bits and flags may also have an effect. to prevent problems caused by these factors, the following procedure should be used when initializing the iic state. 1. execute initialization of the internal state according to the ice bit clearing. 2. execute a stop condition issuance instruction (write 0 to bbsy and scp) to clear the bbsy bit to 0, and wait for two transfer rate clock cycles. 3. re-execute initialization of the internal state according to the ice bit clearing. 4. initialize (re-set) the iic registers.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 514 of 862 rej09b0429-0100 17.5 interrupt source the iic interrupt source is iici. the iic interrupt sources and their priority order are shown in table 17.10. each interrupt source is enabled or disabled by the iccr interrupt enable bit and transferred to the interrupt controller independently. table 17.10 iic interrupt source channel bit name enable bit interrupt source interrupt flag dtc activation priority 2 iici2 ieic i 2 c bus interface interrupt request iric possible high 3 iici3 ieic i 2 c bus interface interrupt request iric possible 0 iici0 ieic i 2 c bus interface interrupt request iric possible 1 iici1 ieic i 2 c bus interface interrupt request iric possible 4 iici4 ieic i 2 c bus interface interrupt request iric not possible 5 iici5 ieic i 2 c bus interface interrupt request iric not possible low
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 515 of 862 rej09b0429-0100 17.6 usage notes 1. in master mode, if an instruction to generate a start condition is immediately followed by an instruction to generate a stop condition, neither condition will be output correctly. to output consecutive start and stop cond itions*, after issuing the instru ction that generates the start condition, read the relevant dr registers of i 2 c bus output pins, check that scl and sda are both low. if the ice bit is set to 1, pin state can be monitored by reading dr register. then issue the instruction that generates the stop condition. note that scl may not yet have gone low when bbsy is cleared to 0. note: * an illegal procedure in the i 2 c bus specification. 2. either of the following two conditions will start the next transfer. pay attention to these conditions when accessing to icdr. ? write to icdr when ice = 1 and trs = 1 (inc luding automatic transfer from icdrt to icdrs) ? read from icdr when ice = 1 and trs = 0 (including automatic transfer from icdrs to icdrr) 3. table 17.11 shows the timing of scl and sda outputs in synchronization with the internal clock. timings on the bus are dete rmined by the rise and fall ti mes of signals affected by the bus load capacitance, series re sistance, and parallel resistance. table 17.11 i 2 c bus timing (scl and sda outputs) item symbol output timing unit notes scl output cycle time t sclo 28 t cyc to 512 t cyc ns scl output high pulse width t sclho 0.5 t sclo ns scl output low pulse width t scllo 0.5 t sclo ns sda output bus free time t bufo 0.5 t sclo ? 1 t cyc ns start condition output hold time t staho 0.5 t sclo ? 1 t cyc ns retransmission start condition output setup time t staso 1 t sclo ns stop condition output setup time t stoso 0.5 t sclo + 2 t cyc ns data output setup time (master) 1 t scllo ? 3 t cyc data output setup time (slave) t sdaso 1 t scllo ? (6 t cyc or 12 t cyc * ) ns data output hold time t sdaho 3 t cyc ns see figure 26.28 (reference) note: * 6 t cyc when iicxn is 0, 12 t cyc when iicxn is 1 (n = 0 to 5).
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 516 of 862 rej09b0429-0100 4. scl and sda input are sampled in synchronization with the internal clock. the ac timing therefore depends on the system clock cycle t cyc , as shown in section 26, electrical characteristics. note that the i 2 c bus interface ac timing specification will not be met with a system clock frequency of less than 5 mhz. 5. the i 2 c bus interface specification for the scl rise time t sr is 1000 ns or less (300 ns for high- speed mode). in master mode, the i 2 c bus interface monitors the scl line and synchronizes one bit at a time during communication. if t sr (the time for scl to go from low to v ih ) exceeds the time determined by the input clock of the i 2 c bus interface, the high period of scl is extended. the scl rise time is determined by the pull-up resistance and load capacitance of the scl line. to insure proper operation at the set transfer rate, adjust the pull-up resistance and load capacitance so that the scl rise time does not exceed the values given in table 17.12. table 17.12 permissible scl rise time (t sr ) values time indication [ns] tcss iicxn t cyc indi- cation i 2 c bus specification (max.) = 20 mhz = 25 mhz = 34 mhz standard mode 1000 375 300 221 0 7.5 t cyc high-speed mode 300 300 300 221 0 1 standard mode 1000 875 700 515 1 0 17.5 t cyc high-speed mode 300 300 300 300 standard mode 1000 1000 1000 1000 1 1 37.5 t cyc high-speed mode 300 300 300 300 note: n = 0 to 5
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 517 of 862 rej09b0429-0100 6. the i 2 c bus interface specifications for the scl and sd a rise and fall times are under 1000 ns and 300 ns. the i 2 c bus interface scl and sda output timing is prescribed by t cyc , as shown in table 17.11. however, because of the rise and fall times, the i 2 c bus interface specifications may not be satisfied at the maximum transfer rate. table 17.13 shows output timing calculations for different operating frequencies, including the worst-case influence of rise and fall times. t bufo fails to meet the i 2 c bus interface specifications at any fr equency. the solution is either (a) to provide coding to secure the necessary inte rval (approximately 1 s) between issuance of a stop condition and issuance of a start condition, or (b) to select devices whose input timing permits this output timing for use as slave devices connected to the i 2 c bus. t scllo in high-speed mode and t staso in standard mode fail to satisfy the i 2 c bus interface specifications for worst- case calculations of t sr /t sf . possible solutions that should be investigated include (a) adjusting the rise and fall times by means of a pull-up resistor and capacitive load, (b) reducing the tr ansfer rate to meet the specifications, or (c) selecting devices whose input timing permits this output timing for use as slave devices connected to the i 2 c bus.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 518 of 862 rej09b0429-0100 table 17.13 i 2 c bus timing (with maximum influence of t sr /t sf ) time indication (at maxi mum transfer rate) [ns] item t cyc indication t sr /t sf influence (max.) i 2 c bus specifi- cation (min.) = 20 mhz = 25 mhz = 34 mhz ? ? standard mode ? ? /200 /224 /224 ? ? high-speed mode ? ? /48 /56 /80 t sclho standard mode ?1000 4000 4000 3480 3706 0.5 t sclo (?t sr ) high-speed mode ?300 600 900 820 876 t scllo standard mode ?250 4700 4750 4230 4456 0.5 t sclo (?t sf ) high-speed mode ?250 1300 950 * 870 * 926 * t bufo standard mode ?1000 4700 3950 * 3440 * 3676 * 0.5 t sclo ?1 t cyc ( ?t sr ) high-speed mode ?300 1300 850 * 780 * 847 * t staho standard mode ?250 4000 4700 4190 4426 0.5 t sclo ?1 t cyc (?t sf ) high-speed mode ?250 600 900 830 897 t staso standard mode ?1000 4700 9000 7960 8412 1 t sclo (?t sr ) high-speed mode ?300 600 2100 1940 2053 t stoso standard mode ?1000 4000 4100 3560 3765 0.5 t sclo + 2 t cyc (?t sr ) high-speed mode ?300 600 1000 900 935 standard mode ?1000 250 3600 3110 3368 t sdaso (master) 1 t scllo * 3 ?3 t cyc (?t sr ) high-speed mode ?300 100 500 450 538 standard mode ?1000 250 3100 3220 3347 t sdaso (slave) 1 t scll * 3 ?12 t cyc * 2 (?t sr ) high-speed mode ?300 100 400 520 64 t sdaho 3 t cyc standard mode 0 0 150 120 88 high-speed mode 0 0 150 120 88 notes: 1. does not meet the i 2 c bus interface specification. rem edial action such as the following is necessary: (a) secure a start/stop condition issuance interval; (b) adjust the rise and fall times by means of a pull-up resistor and capacitive load; (c) reduce the transfer rate; (d) select slave devices whose input timing permits this output timing. the values in the above table will vary de pending on the settings of the bits tcss, iicx3 to iicx0 and cks2 to cks0. depending on the frequency it may not be possible to achieve the maximum transfer rate ; therefore, whether or not the i 2 c bus interface specifications are met must be determi ned in accordance with the actual setting conditions.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 519 of 862 rej09b0429-0100 2. value when the iicxn bit is set to 1. when the iicxn bit is cleared to 0, the value is (? 6t cyc ) (n = 0 to 5). 3. calculated using the i 2 c bus specification values (standard mode: 4700 ns min.; high- speed mode: 1300 ns min.). 7. notes on icdr register read at end of master reception to halt reception at the end of a receive operation in master r eceive mode, set the trs bit to 1 and write 0 to bbsy and scp in iccr. this changes sda from low to high when scl is high, and generates the stop cond ition. after this, receive data can be read by means of an icdr read, but if data remains in the buffer th e icdrs receive data will not be transferred to icdr, and so it will not be possible to read the second byte of data. if it is necessary to read the se cond byte of data, issue the st op condition in master receive mode (i.e. with the trs bit cleared to 0). when reading the receive data, first confirm that the bbsy bit in the iccr register is cleared to 0, the stop condition has been generated, and the bus has been released, then read the ic dr register with trs cleared to 0. note that if the receive data (icdr data) is read in the interval between execution of the instruction for issuance of the stop condition (writing of 0 to bbsy and scp in iccr) and the actual generation of the stop condition, the clock may not be output correctly in subsequent master transmission. clearing of the mst bit afte r completion of master tran smission/reception, or other modifications of iic control bits to change the transmit/receive operating mode or settings, must be carried out during interval (a) in figu re 17.29 (after confirming that the bbsy bit has been cleared to 0 in the iccr register).
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 520 of 862 rej09b0429-0100 sda scl internal clock bbsy bit master receive mode icdr read disabled period bit 0 a 8 9 stop condition (a) start condition execution of instruction for issuing stop condition (write 0 to bbsy and scp) confirmation of stop condition issuance (read bbsy = 0) start condition issuance figure 17.29 notes on re ading master receive data note: this restriction on usage can be cancel ed by setting the fnc1 and fnc0 bits to b 11 in icxr.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 521 of 862 rej09b0429-0100 8. notes on start condition issuance for retransmission figure 17.30 shows the timing of start condition issuance for retransmission, and the timing for subsequently writing data to icdr, together with the corresponding flowchart. write the transmit data to icdr after the start condition fo r retransmission is issued and then the start condition is actually generated. sda iric scl ack bit 7 [3] (retransmission) start condition instruction issuance [4] iric determination [5] icdr write (transmit data) [2] determination of scl = low [1] iric determination start condition generation (retransmission) iric = 1? yes clear iric in iccr read scl pin write transmit data to icdr set bbsy = 1, scp = 0 (iccr) [1] [1] wait for end of 1-byte transfer [2] determine whether scl is low [3] issue start condition instruction for retransmission [4] determine whether start condition is generated or not [5] set transmit data (slave address + r/ w ) [2] [3] [4] [5] yes no no iric = 1? yes scl = low? no note: program so that processing from [3] to [5] is executed continuously. 9 figure 17.30 flowchart for star t condition issuance instruction for retransmission and timing note: this restriction on usage can be can celed by setting the fnc1 and fnc0 bits to b  11 in icxr.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 522 of 862 rej09b0429-0100 9. note on when i 2 c bus interface stop condition instruction is issued in a situation where the rise time of the 9th cl ock of scl exceeds the stipulated value because of a large bus load capacity or where a slave devi ce in which a wait can be inserted by driving the scl pin low is used, the stop condition instruction should be issued after reading scl after the rise of the 9th clock pulse and determining that it is low. stop condition generation scl iric [1] scl = low determination vih [2] stop condition instruction issuance sda 9th clock secures a high period scl is detected as low because the rise of the waveform is delayed figure 17.31 stop condition issuance timing note: this restriction on usage can be cancel ed by setting the fnc1 and fnc0 bits to b 11 in icxr. 10. note on iric flag clear when the wait function is used when the wait function is used in i 2 c bus interface master mode an d in a situation where the rise time of scl exceeds the stipulated value or where a slave device in which a wait can be inserted by driving the scl pin low is used, the iric flag should be cleared after determining that the scl is low. if the iric flag is cleared to 0 when wait = 1 while the scl is extending the high level time, the sda level may change before the scl goes low, which may generate a start or stop condition erroneously.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 523 of 862 rej09b0429-0100 scl iric [1] scl = low determination vih [2] iric clear sda secures a high period scl = low detected figure 17.32 iric flag clea ring timing when wait = 1 note: this restriction on usage can be canceled by setting the fnc1 and fnc0 bits to b'11 in icxr. 11. note on icdr register read and i ccr register access in slave transmit mode in i 2 c bus interface slave transmit mode, do not read icdr or do not read/write from/to iccr during the time shaded in figure 17.33. however, such read and write operations source no problem in interrupt handling processing that is generated in synchronization with the rising edge of the 9th clock pulse because the shaded time has passed before making the transition to interrupt handling. to handle interrupts securely, be sure to keep either of the following conditions. ? read icdr data that has been received so far or read/write from/to iccr before starting the receive operation of the next slave address. ? monitor the bc2 to bc0 counter in icmr; when the count is b'000 (8th or 9th clock pulse), wait for at least two tran sfer clock times in order to read icdr or read/write from/to iccr during the time other than the shaded time.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 524 of 862 rej09b0429-0100 data transmission bit 7 address reception scl trs bit waveform at problem occurrence icdr read and iccr read/write are disabled (6 system clock period) 8 r/ w a 9 the rise of the 9th clock is detected sda icdr write figure 17.33 icdr register read and iccr register access timing in slave transmit mode note: this restriction on usage can be canceled by setting the fnc1 and fnc0 bits to b'11 in icxr. 12. note on trs bit setting in slave mode in i 2 c bus interface slave mode, if the trs bit valu e in iccr is set after detecting the rising edge of the 9th clock pulse or the stop condition before detecting the next rising edge on the scl pin (the time indicated as (a) in figure 17.34), the bit value becomes valid immediately when it is set. however, if the trs bit is set during the other time (the time indicated as (b) in figure 17.34), the bit value is suspended and remains invalid until the rising edge of the 9th clock pulse or the stop condition is detected. th erefore, when the address is received after the restart condition is input without the stop condition, the effective trs bit value remains 1 (transmit mode) internally and thus the acknowledg e bit is not transmitted after the address has been received at the 9th clock pulse. to receive the address in slave mode, clear the trs bit to 0 duri ng the time indicated as (a) in figure 17.34. to release the scl low level that is held by means of the wait function in slave mode, clear the trs bit to and then dummy-read icdr.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 525 of 862 rej09b0429-0100 restart condition data transmission address reception scl trs trs bit setting is suspended in this period icdr dummy read trs bit setting (a) (b) 8 a 9 123 456789 the rise of the 9th clock is detected sda the rise of the 9th clock is detected figure 17.34 trs bit se t timing in slave mode note: this restriction on usage can be can celed by setting the fnc1 and fnc0 bits to b 11 in icxr. 13. note on icdr read in transmit mode and icdr write in receive mode when icdr is read in transmit mode (trs = 1) or icdr is written to in receive mode (trs = 0), the scl pin may not be held low in some cases after transmit/receive operation has been completed, thus inconveniently allowing clock pulses to be output on the scl bus line before icdr is accessed correctly. to access icdr corr ectly, read the icdr after setting receive mode or write to the icdr after setting transmit mode.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 526 of 862 rej09b0429-0100 14. note on acke and trs bits in slave mode in the i 2 c bus interface, if 1 is received as the ackno wledge bit value (ackb = 1) in transmit mode (trs = 1) and then the address is received in slave mode without performing appropriate processing, interrupt handling may start at the rising edge of the 9th clock pulse even when the address does not match. similarly, if the star t condition and address are transmitted from the master device in slave transmit mode (trs = 1), the icdre flag is set, and 1 is received as the acknowledge bit value (ackb = 1), the iric flag may be set thus causing an interrupt source even when the addres s does not match. to use the i 2 c bus interface module in slave mode, be sure to follow the procedures below. ? when having received 1 as the acknowledge bit value for the la st transmit data at the end of a series of transmit operation, clear the acke bit in iccr once to initialize the ackb bit to 0. ? set receive mode (trs = 0) before the ne xt start condition is input in slave mode. complete transmit operation by the procedure shown in figure 17.23, in order to switch from slave transmit mode to slave receive mode. 15. notes on arbitration lost in master mode operation the i 2 c bus interface recognizes the data in tr ansmit/receive frame as an address when arbitration is lost in master mode and a tran sition to slave receive mode is automatically carried out. when arbitration is lost not in the first frame but in the second frame or subsequent frame, transmit/receive data that is not an address is compared with th e value set in the sar or sarx register as an address. if the receive data matches with the addres s in the sar or sarx register, the i 2 c bus interface erroneously recognizes that the address call has occurred. (see figure 17.35.) in multi-master mode, a bus conflict could happen. when the i 2 c bus interface is operated in master mode, check the state of the al bit in th e icsr register every time after one frame of data has been transmitted or received. when arbitration is lost during transmitting the second frame or subsequent frame, take avoidance measures.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 527 of 862 rej09b0429-0100 s s s a a a a a sla sla sla data 1 data 2 sla r/ w r/ w r/ w r/ w a data 3 a data 4 i2c bus interface (master transmit mode) transmit data match transmit timing match ? receive address is ignored ? automatically transferred to slave receive mode ? receive data is recognized as an address ? when the receive data matches to the address set in the sar or sarx register, the i2c bus interface operates as a slave device. ? arbitration is lost ? the al flag in icsr is set to 1 transmit data does not match data contention other device (master transmit mode) i2c bus interface (slave receive mode) figure 17.35 diagram of erroneou s operation when arbitration lost though it is prohibited in the normal i 2 c protocol, the same problem may occur when the mst bit is erroneously set to 1 and a transition to master mode is occurred during data transmission or reception in slave mode. when the mst bit is set to 1 during data transmission or reception in slave mode, the arbitration decision circuit is en abled and arbitration is lost if conditions are satisfied. in this case, the transmit/receive data wh ich is not an address may be erroneously recognized as an address. in multi-master mode, pay attention to the se tting of the mst bit when a bus conflict may occur. in this case, the mst bit in the iccr register should be set to 1 according to the order below. a. make sure that the bbsy flag in the iccr re gister is 0 and the bus is free before setting the mst bit. b. set the mst bit to 1. c. to confirm that the bus was not entered to the busy state while the mst bit is being set, check that the bbsy flag in the iccr register is 0 immediately after the mst bit has been set. note: above restrictions can be released by setti ng the bits fnc1 and fnc2 in icxr to b'11.
section 17 i 2 c bus interface (iic) rev. 1.00 mar. 17, 2008 page 528 of 862 rej09b0429-0100
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 529 of 862 rej09b0429-0100 section 18 lpc interface (lpc) this lsi has an on-chip lpc interface. the lpc includes three register sets, each of which comprises data and status registers, control register, the fast gate a20 logic circuit, and the host interrupt request circuit. the lpc performs serial transfer of cycle type, address, and data, synchronized with the 33 mhz pci clock. it uses four signal lines for address/data and one for host interrupt requests. this lpc module supports i/o read and i/o write cycle transfers. it is also provided with power-down functions that can control the pci cl ock and shut down the lpc interface. 18.1 features ? supports lpc interface i/o re ad and i/o write cycles ? uses four signal lines (lad3 to lad0) to transfer the cycle type, address, and data. ? uses three control signals: clock (lclk), reset ( lreset ), and frame ( lframe ). ? three register sets comprising data and status registers ? the basic register set comprises three bytes: an input register (idr), output register (odr), and status register (str). ? i/o addresses from h'0000 to h'ffff ar e selected for channels 1 to 3. ? a fast gate a20 function is provided for channel 1. ? for channel 3, sixteen bidirectional data register bytes can be manipulated in addition to the basic register set. ? supports scif ? the lpc interface is connected to the scif, a llowing direct control of the scif by the lpc host.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 530 of 862 rej09b0429-0100 ? supports serirq ? host interrupt requests are transferred serially on a single signal line (serirq). ? on channel 1, hirq1 and hirq12 can be generated. ? on channels 2 and 3, smi, hirq6, and hirq9 to hirq11 can be generated. ? in the scif, smi, and hirq1 to hirq15 can be generated. ? operation can be switched between quiet mode and continuous mode. ? the clkrun signal can be manipulated to restart the pci clock (lclk). ? power-down modes and interrupts ? the lpc module can be shut down by inputting the lpcpd signal. ? three pins, pme , lsmi , and lsci, are provided for general input/output. ? supports version 1.5 of the intelligent platform management interface (ipmi) specifications ? channel 3 supports the smic interf ace, kcs interface, and bt interface.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 531 of 862 rej09b0429-0100 figure 18.1 shows a block diagram of the lpc. idr3 idr2 idr1 twr0mw odr2 odr3 odr1 str3 str2 str1 twr0sw serirq clkrun lsci lsmi pme lpcpd lreset lclk lframe obei ibfi1 ibfi2 ibfi3 erri ga20 sirqcr0 to 5 hisel lscie lscib lsci input lsmie lsmib lsmi input pmee pmeb pme input module data bus cycle detection serial parallel conversion serial parallel conversion address match sync output parallel serial conversion control logic internal interrupt control twr1 to twr15 twr1 to twr15 lad0 to lad3 hicr0 to hicr5 btdtr fifo (in) btdtr fifo (out) ladr1 ladr2 ladr3 ladr12 [legend] hicr0 to hicr5: ladr12h, ladr12l: ladr3h, ladr3l: idr1 to idr3: odr1 to odr3: str1 to str3: host interface control registers 0 to 5 lpc channel 1, 2 address registers 12h and 12l lpc channel 3 address registers 3h and 3l input data registers 1 to 3 output data registers 1 to 3 status registers 1 to 3 twr0mw: twr0sw: twr1 to twr15: sirqcr0 to sirqcr5: hisel: bidirectional data register 0mw bidirectional data register 0sw bidirectional data registers 1 to 15 serirq control registers 0 to 5 host interface select register figure 18.1 block diagram of lpc
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 532 of 862 rej09b0429-0100 18.2 input/output pins table 18.1 lists the lpc pin configuration. table 18.1 pin configuration name abbreviation port i/o function lpc address/ data 3 to 0 lad3 to lad0 pe to pe0 i/o c ycle type/address/data signals serially (4-signal-line) transferred in synchronization with lclk lpc frame lframe pe4 input * 1 transfer cycle start and forced termination signal lpc reset lreset pe5 input * 1 lpc interface reset signal lpc clock lclk pe6 input 33-mhz pci clock signal serialized interrupt request serirq pe7 i/o * 1 serialized host interrupt request signal (smi, hirq1 to hirq15) in synchronization with lclk lsci general output lsci pd0 output * 1, * 2 general output lsmi general output lsmi pd1 output * 1, * 2 general output pme general output pme pd2 output * 1, * 2 general output gate a20 ga20 pd3 output * 1, * 2 gate a20 control signal output lpc clock run clkrun pd4 i/o * 1, * 2 lclk restart request signal when serial host interrupt is requested lpc power-down lpcpd pd5 input * 1 lpc module shutdown signal notes: 1. pin state monitoring input is possi ble in addition to the lpc interface control input/output function. 2. only 0 can be output. if 1 is output, the pin is in the high-impedance state, so an external resistor is necessary to pull the signal up to vcc.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 533 of 862 rej09b0429-0100 18.3 register descriptions the lpc has the following registers. ? host interface control register 0 (hicr0) ? host interface control register 1 (hicr1) ? host interface control register 2 (hicr2) ? host interface control register 3 (hicr3) ? host interface control register 4 (hicr4) ? host interface control register 5 (hicr5) ? pin function control register (pinfncr) ? lpc channel 1, 2 address register h, l (ladr12h, ladr12l) ? lpc channel 3 address register h, l (ladr3h, ladr3l) ? input data register 1 (idr1) ? input data register 2 (idr2) ? input data register 3 (idr3) ? output data register 1 (odr1) ? output data register 2 (odr2) ? output data register 3 (odr3) ? status register 1 (str1) ? status register 2 (str2) ? status register 3 (str3) ? bidirectional data registers 0 to 15 (twr0 to twr15) ? serirq control register 0 (sirqcr0) ? serirq control register 1 (sirqcr1) ? serirq control register 2 (sirqcr2) ? serirq control register 3 (sirqcr3) ? serirq control register 4 (sirqcr4) ? serirq control register 5 (sirqcr5) ? host interface select register (hisel) ? scif address register h, l (scifadrh, scifadrl)
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 534 of 862 rej09b0429-0100 the following registers are necessary for smic mode ? smic flag register (smicflg) ? smic control/status register (smiccsr) ? smic data register (smicdtr) ? smic interrupt register 0 (smicir0) ? smic interrupt register 1 (smicir1) the following registers are necessary for bt mode ? bt status register 0 (btsr0) ? bt status register 1 (btsr1) ? bt control/status register 0 (btcsr0) ? bt control/status register 1 (btcsr1) ? bt control register (btcr) ? bt data buffer (btdtr) ? bt interrupt mask register (btimsr) ? fifo valid size register 0 (btfvsr0) ? fifo valid size register 1 (btfvsr1)
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 535 of 862 rej09b0429-0100 18.3.1 host interface control registers 0 and 1 (hicr0 and hicr1) hicr0 and hicr1 contain control bits that enable or disable lpc interface functions, control bits that determine pin output and the internal state of the lpc interface, and status flags that monitor the internal state of the lpc interface. ? hicr0 r/w bit bit name initial value slave host description 7 6 5 lpc3e lpc2e lpc1e 0 0 0 r/w r/w r/w ? ? ? lpc enable 3 to 1 enable or disable the lpc interface function. when the lpc interface is enabled (one of the three bits is set to 1), processing for data transfer between the slave (this lsi) and the host is performed using pins lad3 to lad0, lframe , lreset , lclk, serirq, clkrun , and lpcpd . ? lpc3e 0: lpc channel 3 operation is disabled no address (ladr3) matches for idr3, odr3, str3, twr0 to twr15, smic, kcs, or bt 1: lpc channel 3 operation is enabled ? lpc2e 0: lpc channel 2 operation is disabled no address (ladr2) matches for idr2, odr2, or str2 1: lpc channel 2 operation is enabled ? lpc1e 0: lpc channel 1 operation is disabled no address (ladr1) matches for idr1, odr1, or str1 1: lpc channel 1 operation is enabled
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 536 of 862 rej09b0429-0100 r/w bit bit name initial value slave host description 4 fga20e 0 r/w ? fast gate a20 function enable enables or disables the fast gate a20 function. the pd3ddr bit should be cleared to 0 when the lpc is used. with the fast gate a20 disabled, the normal gate a20 can be implemented by firmware controlling pd3 output. 0: fast gate a20 function disabled general i/o function of pin pd3 is enabled the internal state of ga20 ou tput is initialized to 1 1: fast gate a20 function enabled ga20 pin output is open-drain (external pull-up resistor (vcc) required) 3 sdwne 0 r/w ? lpc software shutdown enable controls lpc interface shutdown. for details of the lpc shutdown function, and the scope of initialization by an lpc reset and an lpc shutdown, see section 18.4.6, lpc interface shut down function (lpcpd). 0: normal state, lpc software shutdown setting enabled [clearing conditions] ? writing 0 ? lpc hardware reset or lpc software reset ? lpc hardware shutdown release (rising edge of lpcpd signal) 1: lpc hardware shutdown state setting enabled hardware shutdown state when lpcpd signal is low level [setting condition] writing 1 after reading sdwne = 0
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 537 of 862 rej09b0429-0100 r/w bit bit name initial value slave host description 2 pmee 0 r/w ? pme output enable controls pme output in co mbination with the pmeb bit in hicr1. pme pin output is open-drain, and an external pull-up resistor (vcc) is needed. the pd2ddr bit should be cleared to 0 when the lpc is used. pmee pmeb 0 x : pme output disabled; general i/o function of pin pd2 is enabled 1 0 : pme output enabled, pme pin output goes to 0 level 1 1 : pme output enabled, pme pin output is high-impedance 1 lsmie 0 r/w ? lsmi output enable controls lsmi output in combination with the lsmib bit in hicr1. lsmi pin output is open-drain, and an external pull-up resistor (vcc) is needed. the pd1ddr bit should be cleared to 0 when the lpc is used. lsmie lsmib 0 x : lsmi output disabled; general i/o function of pin pd1 is enabled 1 0 : lsmi output enabled, lsmi pin output goes to 0 level 1 1 : lsmi output enabled, lsmi pin output is hi-z
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 538 of 862 rej09b0429-0100 r/w bit bit name initial value slave host description 0 lscie 0 r/w ? lsci output enable controls lsci output in co mbination with the lscib bit in hicr1. lsci pin output is open-drain, and an external pull-up resistor (vcc) is needed. the pd0ddr bit should be cleared to 0 when the lpc is used. lscie lscib 0 x : lsci output disabled; general i/o function of pin pd0 is enabled 1 0 : lsci output enabled, lsci pin output goes to 0 level 1 1 : lsci output enabled, lsci pin output is high-impedance [legend] x: don't care
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 539 of 862 rej09b0429-0100 ? hicr1 r/w bit bit name initial value slave host description 7 lpcbsy 0 r ? lpc busy indicates that the lpc interface is processing a transfer cycle. 0: lpc interface is in transfer cycle wait state ? bus idle, or transfer cycle not subject to processing is in progress ? cycle type or address indeterminate during transfer cycle [clearing conditions] ? lpc hardware reset or lpc software reset ? lpc hardware shutdown or lpc software shutdown ? forced termination (abort) of transfer cycle subject to processing ? normal termination of transfer cycle subject to processing 1: lpc interface is performing transfer cycle processing [setting condition] match of cycle type and address
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 540 of 862 rej09b0429-0100 r/w bit bit name initial value slave host description 6 clkreq 0 r ? lclk request indicates that the lpc interface's serirq output is requesting a restart of lclk. 0: no lclk restart request [clearing conditions] ? lpc hardware reset or lpc software reset ? lpc hardware shutdown or lpc software shutdown ? serirq is set to continuous mode ? there are no further interrupts for transfer to the host in quiet mode 1: lclk restart request issued [setting condition] in quiet mode, serirq interrupt output becomes necessary while lclk is stopped 5 irqbsy 0 r ? serirq busy indicates that the lpc interface's serirq is engaged in transfer processing. 0: serirq transfer frame wait state [clearing conditions] ? lpc hardware reset or lpc software reset ? lpc hardware shutdown or lpc software shutdown ? end of serirq transfer frame 1: serirq transfer processing in progress [setting condition] start of serirq transfer frame
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 541 of 862 rej09b0429-0100 r/w bit bit name initial value slave host description 4 lrstb 0 r/w ? lpc software reset bit resets the lpc interface. for the scope of initialization by an lpc reset, see section 18.4.6, lpc interface shutdown function (lpcpd). 0: normal state [clearing conditions] ? writing 0 ? lpc hardware reset 1: lpc software reset state [setting condition] writing 1 after reading lrstb = 0 3 sdwnb 0 r/w ? lpc software shutdown bit controls lpc interface shutdown. for details of the lpc shutdown function, and the scope of initialization by an lpc reset and an lpc shutdown, see section 18.4.6, lpc interface shut down function (lpcpd). 0: normal state [clearing conditions] ? writing 0 ? lpc hardware reset or lpc software reset ? lpc hardware shutdown (falling edge of lpcpd signal when sdwne = 1) ? lpc hardware shutdown release (rising edge of lpcpd signal when sdwne = 0) 1: lpc software shutdown state [setting condition] writing 1 after reading sdwnb = 0 2 pmeb 0 r/w ? pme output bit controls pme output in combination with the pmee bit. for details, refer to description on the pmee bit in hicr0.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 542 of 862 rej09b0429-0100 r/w bit bit name initial value slave host description 1 lsmib 0 r/w ? lsmi output bit controls lsmi output in combination with the lsmie bit. for details, refer to description on the lsmie bit in hicr0. 0 lscib 0 r/w ? lsci output bit controls lsci output in combination with the lscie bit. for details, refer to description on the lscie bit in hicr0.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 543 of 862 rej09b0429-0100 18.3.2 host interface control registers 2 and 3 (hicr2 and hicr3) hicr2 controls interrupts to an lpc interface sl ave (this lsi). hicr3 moni tors the states of the lpc interface pins. bits 6 to 0 in hicr2 are initialized to h'00 by a reset. the states of other bits are decided by the pin states. the pin states can be monitored by the pin monitoring bits regardless of the lpc interface operating state or the operating state of the functions that use pin multiplexing. ? hicr2 r/w bit bit name initial value slave host description 7 ga20 undefined r ? ga20 pin monitor 6 lrst 0 r/(w) * ? lpc reset interrupt flag this bit is a flag that generates an erri interrupt when an lpc hardware reset occurs. 0: [clearing condition] writing 0 after reading lrst = 1 1: [setting condition] lreset pin falling edge detection 5 sdwn 0 r/(w) * ? lpc shutdown interrupt flag this bit is a flag that generates an erri interrupt when an lpc hardware shutdown request is generated. 0: [clearing conditions] ? writing 0 after reading sdwn = 1 ? lpc hardware reset ( lreset pin falling edge detection) ? lpc software reset (lrstb = 1) 1: [setting condition] lpcpd pin falling edge detection
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 544 of 862 rej09b0429-0100 r/w bit bit name initial value slave host description 4 abrt 0 r/(w) * ? lpc abort interrupt flag this bit is a flag that generates an erri interrupt when a forced termination (abort) of an lpc transfer cycle occurs. 0: [clearing conditions] ? writing 0 after reading abrt = 1 ? lpc hardware reset ( lreset pin falling edge detection) ? lpc software reset (lrstb = 1) ? lpc hardware shutdown (sdwne = 1 and lpcpd pin falling edge detection) ? lpc software shutdown (sdwnb = 1) 1: [setting condition] lframe pin falling edge detection during lpc transfer cycle 3 ibfie3 0 r/w ? idr3 and twr receive complete interrupt enable enables or disables ibfi3 interrupt to the slave (this lsi). 0: input data register (idr3) and twr receive complete interrupt requests and smic/bt mode interrupt requests disabled 1: [when twrie = 0 in ladr3] input data register (idr3) receive complete interrupt requests and smic/bt mode interrupt requests enabled [when twrie = 1 in ladr3] input data register (idr3) and twr receive complete interrupt requests and smic/bt mode interrupt requests enabled
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 545 of 862 rej09b0429-0100 r/w bit bit name initial value slave host description 2 ibfie2 0 r/w ? idr2 receive complete interrupt enable enables or disables ibfi2 interrupt to the slave (this lsi). 0: input data register (idr2) receive complete interrupt requests disabled 1: input data register (idr2) receive complete interrupt requests enabled 1 ibfie1 0 r/w ? idr1 receive complete interrupt enable enables or disables ibfi1 interrupt to the slave (this lsi). 0: input data register (idr1) receive complete interrupt requests disabled 1: input data register (idr1) receive complete interrupt requests enabled 0 errie 0 r/w ? error interrupt enable enables or disables erri interrupt to the slave (this lsi). 0: error interrupt requests disabled 1: error interrupt requests enabled note: * only 0 can be written to bits 6 to 4, to clear the flag. ? hicr3 r/w bit bit name initial valu e slave host description 7 lframe undefined r ? lframe pin monitor 6 clkrun undefined r ? clkrun pin monitor 5 serirq undefined r ? serirq pin monitor 4 lreset undefined r ? lreset pin monitor 3 lpcpd undefined r ? lpcpd pin monitor 2 pme undefined r ? pme pin monitor 1 lsmi undefined r ? lsmi pin monitor 0 lsci undefined r ? lsci pin monitor
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 546 of 862 rej09b0429-0100 18.3.3 host interface control register 4 (hicr4) hicr4 controls the operation of the kcs, smic, and bt interface functions on channel 3. r/w bit bit name initial va lue slave host description 7 ladr12sel 0 r/w ? switches the channel accessed via ladr12h and ladr12l. 0: ladr1 is selected 1: ladr2 is selected 6 to 4 ? all 0 r/w ? reserved the initial value should not be changed. 3 swenbl 0 r/w ? in bt mode, h'5 (short wait) or h'6 (long wait) is returned to the host in the synchronized return cycle from slave, thus can make the host wait. 0: short wait is issued 1: long wait is issued 2 kcsenbl 0 r/w ? enables or disables the use of the kcs interface included in channel 3. when the lpc3e bit in hicr0 is 0, this bit is valid. 0: kcs interface operation is disabled no address (ladr3) matches for idr3, odr3, or str3 in kcs mode 1: kcs interface operation is enabled 1 smicenbl 0 r/w ? enables or disables the use of the smic interface included in channel 3. when the lpc3e bit in hicr0 is 0, this bit is valid. 0: smic interface operation is disabled no address (ladr3) matches for smicflg, ssmiccsr, or smicdtr 1: smic interface operation is enabled
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 547 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 0 btenbl 0 r/w ? enables or disables the use of the bt interface included in channel 3. when the lpc3e bit in hicr0 is 0, this bit is valid. 0: bt interface operation is disabled no address (ladr3) matches for btimsr, btcr, or btdtr 1: bt interface operation is enabled 18.3.4 host interface control register 5 (hicr5) hicr5 enables or disables the operation of the scif interface, and cont rols obei interrupts. r/w bit bit name initial value slave host description 7 to 2 ? all 0 r/w ? reserved the initial value bit should not be changed. 1 scife 0 r/w ? scif enable enables or disables access from the lpc host of the scif. 0: disables access to the scif from the lpc host 1: enables access to the scif from the lpc host 0 ? 0 r/w ? reserved the initial value should not be changed.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 548 of 862 rej09b0429-0100 18.3.5 pin function co ntrol register (pinfncr) pinfncr selects whether the pins of the associated port are used for the lpc function or general i/o. r/w bit bit name initial value slave host description 7 to 3 ? all 0 r/w ? reserved the initial value bit should not be changed. 2 serirqoff 0 r/w ? 0: serirq pin 1: general i/o port 1 lpcpdoff 0 r/w ? 0: lpcpd pin 1: general i/o port 0 clkrunoff 0 r/w ? 0: clkrun pin 1: general i/o port 18.3.6 lpc channel 1, 2 address register h, l (ladr12h, ladr12l) ladr12h and ladr12l are temporary register s for accessing internal registers ladr1h, ladr1l, ladr2h, and ladr2l. when the ladr12sel bit in hicr4 is 0, lpc channel 1 host addresses (ladr1h, ladr1l) are set through ladr12. the contents of the address field in ladr1 must not be changed while channel 1 is operating (while lpc1e is set to 1). when the ladr12sel bit is 1, lpc channel 2 host addresses (ladr2h, ladr2l) are set through ladr12. the contents of the address field in ladr2 must not be changed while channel 2 is operating (while lpc2e is set to 1). table 18.2 shows the initial value of each register. table 18.3 shows the host register selection in address match determination. table 18.4 shows the slave selection internal registers in slave (this lsi) access. table 18.2 ladr1, ladr2 initial values register name initial value description ladr1 h'0060 i/o address of channel 1 ladr2 h'0062 i/o address of channel 2
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 549 of 862 rej09b0429-0100 table 18.3 host register selection i/o address bits 15 to 3 bit 2 bit 1 bit 0 transfer cycle host register selection ladr1 (bits 15 to 3) 0 ladr1 (bit 1) la dr1 (bit 0) i/o write idr1 write (data), c/ d 1 0 ladr1 (bits 15 to 3) 1 ladr1 (bit 1) la dr1 (bit 0) i/o write i dr1 write (command), c/ d 1 1 ladr1 (bits 15 to 3) 0 ladr1 (bit 1) ladr1 (bit 0) i/o read ord1 read ladr1 (bits 15 to 3) 1 ladr1 (bit 1) ladr1 (bit 0) i/o read str1 read ladr2 (bits 15 to 3) 0 ladr2 (bit 1) la dr2 (bit 0) i/o write idr2 write (data), c/ d 2 0 ladr2 (bits 15 to 3) 1 ladr2 (bit 1) la dr2 (bit 0) i/o write i dr2 write (command), c/ d 2 1 ladr2 (bits 15 to 3) 0 ladr2 (bit 1) ladr2 (bit 0) i/o read odr2 read ladr2 (bits 15 to 3) 1 ladr2 (bit 1) ladr2 (bit 0) i/o read str2 read table 18.4 slave select ion internal registers slave (r/w) bus width (b/w) ladr 12sel ladr12 internal register r/w b 0 ladr12h ladr1h r/w b 1 ladr12h ladr2h r/w b 0 ladr12l ladr1l r/w b 1 ladr12l ladr2l r/w w 0 ladr12h ladr12l ladr1h ladr1l r/w w 1 ladr12h ladr12l ladr2h ladr2l
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 550 of 862 rej09b0429-0100 18.3.7 lpc channel 3 address register h, l (ladr3h, ladr3l) ladr3 comprises two 8-bit readable/writable regi sters that perform lpc channel 3 host address setting and control the operation of the bidirectional data registers. the contents of the address field in ladr3 must not be changed while channel 3 is operating (while lpc3e is set to 1). ? ladr3h r/w bit bit name initial valu e slave host description 7 6 5 4 3 2 1 0 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 all 0 r/w ? channel 3 address bits 15 to 8 the host address of lpc channel 3 is set. ? ladr3l r/w bit bit name initial valu e slave host description 7 6 5 4 3 bit 7 bit 6 bit 5 bit 4 bit 3 all 0 r/w ? channel 3 address bits 7 to 3 the host address of lpc channel 3 is set. 2 ? 0 r/w ? reserved the initial value should not be changed. 1 bit 1 0 r/w ? channel 3 address bit 1 the host address of lpc channel 3 is set. 0 twre 0 r/w ? bidirectional data register enable enables or disables bidirectional data register operation. clear this bit to 0 in kcs mode. 0: twr operation is disabled twr-related address (ladr3) match does not occur. 1: twr operation is enabled
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 551 of 862 rej09b0429-0100 when lpc3e = 1, an i/o address received in an lp c i/o cycle is compared with the contents of ladr3. when determining an idr3, odr3, or str3 address match, bit 0 in ladr3 is regarded as 0, and the value of bit 2 is ignored. when determining a twr0 to twr15 address match, bit 4 of ladr3 is inverted, and the values of bits 3 to 0 are ignored. when determining an idr3, odr3, or str3 address match in kcs mode , an smicflg, smiccsr, smicdtr address match in smic mode, and a btdtr, btcr, btimsr address match in bt mode, the values of bits 3 to 0 are ignored. register selection according to the bits ignored in address match de termination is as shown in the following table. i/o address bits 15 to5 bit 4 bit 3 bit 2 bit 1 bit 0 transfer cycle host register selection bits 15 to5 bit 4 bit 3 0 bit 1 0 i/o write idr3 write, c/ d 3 0 bits 15 to5 bit 4 bit 3 1 bit 1 0 i/o write idr3 write, c/ d 3 1 bits 15 to5 bit 4 bit 3 0 bit 1 0 i/o read odr3 read bits 15 to5 bit 4 bit 3 1 bit 1 0 i/o read str3 read bits 15 to5 bit 4 0 0 0 0 i/o write twr0mw write bits 15 to5 bit 4 0 0 0 1 i/o write twr1 to twr15 write ? ? ? ? ? ? ? ? ? ? ? ? 1 1 1 1 bits 15 to5 bit 4 0 0 0 0 i/o read twr0sw read bits 15 to5 bit 4 0 0 0 1 i/o read twr1 to twr15 read ? ? ? ? ? ? ? ? ? ? ? ? 1 1 1 1
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 552 of 862 rej09b0429-0100 ? kcs mode i/o address bits 15 to5 bit 4 bit 3 bit 2 bit 1 bit 0 transfer cycle host register selection bits 15 to5 bit 4 0 0 1 0 i/o write idr3 write, c/ d 3 0 bits 15 to5 bit 4 0 0 1 1 i/o write idr3 write, c/ d 3 1 bits 15 to5 bit 4 0 0 1 0 i/o read odr3 read bits 15 to5 bit 4 0 0 1 1 i/o read str3 read ? bt mode i/o address bits 15 to5 bit 4 bit 3 bit 2 bit 1 bit 0 transfer cycle host register selection bits 15 to5 bit 4 0 1 0 0 i/o write btcr write bits 15 to5 bit 4 0 1 0 1 i/o write btdtr write bits 15 to5 bit 4 0 1 1 0 i/o write btimsr write bits 15 to5 bit 4 0 1 0 0 i/o read btcr read bits 15 to5 bit 4 0 1 0 1 i/o read btdtr read bits 15 to5 bit 4 0 1 1 0 i/o read btimsr read ? smic mode i/o address bits 15 to5 bit 4 bit 3 bit 2 bit 1 bit 0 transfer cycle host register selection bits 15 to5 bit 4 1 0 0 1 i/o write smicdtr write bits 15 to5 bit 4 1 0 1 0 i/o write smiccsr write bits 15 to5 bit 4 1 0 1 1 i/o write smicflg write bits 15 to5 bit 4 1 0 0 1 i/o read smicdtr read bits 15 to5 bit 4 1 0 1 0 i/o read smiccsr read bits 15 to5 bit 4 1 0 1 1 i/o read smicflg read
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 553 of 862 rej09b0429-0100 18.3.8 input data registers 1 to 3 (idr1 to idr3) the idr registers are 8-bit read-only registers to the slave processor (this lsi), and 8-bit write- only registers to the host processor. the register s selected from the host according to the i/o address are described in the follo wing sections: for information on idr1 and idr2 selection, see section 18.3.6, lpc channel 1, 2 address register h, l (ladr12h, ladr12l), and for information on idr3 selection, see section 18.3.7, lpc cha nnel 3 address register h, l (ladr3h, ladr3l). data transferred in an lp c i/o write cycle is written to the selected register. the state of bit 2 of the i/o address is latched into the c/ d bit in str, to indicate whether the written information is a command or data. the initial values of the idr registers are undefined. 18.3.9 output data registers 0 to 3 (odr1 to odr3) the odr registers are 8-bit readab le/writable registers to the slav e processor (this lsi), and 8-bit read-only registers to the host pr ocessor. the registers selected fr om the host according to the i/o address are described in the follo wing sections: for information on odr1 and odr2 selection, see section 18.3.6, lpc channel 1, 2 address register h, l (ladr12h, ladr12l), and for information on odr3 selection, see section 18.3.7, lpc channel 3 address register h, l (ladr3h, ladr3l). in an lpc i/o read cycle, the data in the selected register is transferred to the host. the initial values of the od r registers are undefined.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 554 of 862 rej09b0429-0100 18.3.10 bidirectional data regist ers 0 to 15 (twr0 to twr15) twr0 to twr15 are sixteen 8-bit readable/writabl e registers to both the slave processor (this lsi) and the host processor. in twr0, however, two registers (twr0mw and twr0sw) are allocated to the same address fo r both the host addr ess and the slave address. twr0mw is a write-only register to the host processor, and a read-only register to th e slave processor, while twr0sw is a write-only register to the slave processor and a read-only register to the host processor. when the host and slave processors begin a write, after the respective twr0 registers have been written to, access right arbitration for simultaneous access is performed by checking the status flags to see if those writ es were valid. for the registers se lected from the host according to the i/o address, see section 18.3.7, lpc channel 3 address register h, l (ladr3h, ladr3l). data transferred in an lpc i/o write cycle is wri tten to the selected register; in an lpc i/o read cycle, the data in the selected re gister is transferred to the host. the initial values of twr0 to twr15 are undefined.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 555 of 862 rej09b0429-0100 18.3.11 status registers 1 to 3 (str1 to str3) the str registers are 8-bit registers that indi cate status information during lpc interface processing. bits 3, 1, and 0 in str1 to str3 are read-only bits to both the host processor and the slave processor (this lsi). however, 0 only can be written from the slave processor (this lsi) to bit 0 in str1 to str3, and bits 6 and 4 in str3, in order to clear the flags to 0. the functions for bits 7 to 4 in str3 differ according to the settings of bit selstr3 in hisel and the twre bit in ladr3l. for details, see section 18.3.18, host interface select register (hisel). the registers selected from the host processor according to the i/o address are described in the following sections. for information on str1 and str2 selection, see section 18.3.6, lpc channel 1,2 address register h, l (ladr12h, ladr12l), and information on str3 selection, see section 18.3.7, lpc channel 3 address register h, l (l adr3h, ladr3l). in an lpc i/o read cycle, the data in the selected register is transferred to the host processor. the str registers are initialized to h'00 by a reset or in hardware standby mode. ? str1 r/w bit bit name initial va lue slave host description 7 6 5 4 dbu17 dbu16 dbu15 dbu14 all 0 r/w r defined by user the user can use these bits as necessary. 3 c/ d 1 0 r r command/data when the host processor writes to an idr1 register, bit 2 of the i/o address (when ch1offsel1 = 0) or bit 0 of the i/o address (when ch1offsel1 = 1) is written to this bit to indi cate whether idr1 contains data or a command. 0: content of input data register (idr1) is data 1: content of input dat a register (idr1) is a command 2 dbu12 0 r/w r defined by user the user can use this bit as necessary.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 556 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 1 ibf1 0 r r input data register full indicates whether or not there is receive data in idr1. this bit is an internal interrupt source to the slave processor (this lsi). the ibf1 flag setting and clearing conditions are different when the fast a20 gate is used. for details see table 16.7. 0: there is not receive data in idr1 [clearing condition] when the slave processor reads idr 1: there is receive data in idr1 [setting condition] when the host processor writes to idr using i/o write cycle 0 obf1 0 r/(w) * r output data register full indicates whether or not there is transmit data in odr1. 0: there is not transmit data in odr1 [clearing condition] when the host processor reads odr1 using i/o read cycle, or the slave processor writes 0 to the obf1 bit 1: there is transmit data in odr1 [setting condition] when the slave processor writes to odr1 note: * only 0 can be written to clear the flag.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 557 of 862 rej09b0429-0100 ? str2 r/w bit bit name initial va lue slave host description 7 6 5 4 dbu27 dbu26 dbu25 dbu24 0 0 0 0 r/w r/w r/w r/w r r r r defined by user the user can use these bits as necessary. 3 c/ d 2 0 r r command/data when the host writes to idr2, bit 2 of the i/o address (when ch2offsel1 = 0) or bit 0 of the i/o address (when ch2offsel1 = 1) is written to this bit to indicate whether idr2 contains data or a command. 0: content of input data re gister (idr2) is a data 1: content of input dat a register (idr2) is a command 2 dbu22 0 r/w r defined by user the user can use this bit as necessary. 1 ibf2 0 r r input data register full indicates whether or not there is receive data in idr2.this bit is an internal interrupt source to the slave (this lsi). 0: there is not receive data in idr2 [clearing condition] when the slave reads idr2 1: there is receive data in idr2 [setting condition] when the host writes to idr2 in an i/o write cycle
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 558 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 0 obf2 0 r/(w) * r output data register full indicates whether or not there is transmit data in odr2. 0: there is not transmit data in odr2 [clearing conditions] ? when the host reads odr2 in an i/o read cycle ? when the slave writes 0 to bit obf2 1: there is transmit data in odr2 [setting condition] ? when the slave writes to odr2 note: * only 0 can be written to clear the flag.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 559 of 862 rej09b0429-0100 ? str3 (twre = 1 or selstr3 = 0) r/w bit bit name initial va lue slave host description 7 ibf3b 0 r r bidirectional data register input buffer full flag this is an internal interrupt source to the slave (this lsi). 0: [clearing condition] when the slave reads twr15 1: [setting condition] when the host writes to twr15 in i/o write cycle 6 obf3b 0 r/(w) * r bidirectional data regist er output buffer full flag 0: [clearing conditions] ? when the host reads twr15 in i/o read cycle ? when the slave writes 0 to the obf3b bit 1: [setting condition] when the slave writes to twr15 5 mwmf 0 r r master write mode flag 0: [clearing condition] when the slave reads twr15 1: [setting condition] when the host writes to twr0 in i/o write cycle while swmf = 0 4 swmf 0 r/(w) * r slave write mode flag in the event of simultaneo us writes by the master and the slave, the master write has priority. 0: [clearing conditions] ? when the host reads twr15 in i/o read cycle ? when the slave writes 0 to the swmf bit 1: [setting condition] when the slave writes to twr0 while mwmf = 0
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 560 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 3 c/ d 3 0 r r command/data flag when the host writes to idr3, bit 2 of the i/o address is written into this bit to indicate whether idr3 contains data or a command. 0: content of input data re gister (idr3) is a data 1: content of input data register (idr3) is a command 2 dbu32 0 r/w r defined by user the user can use this bit as necessary. 1 ibf3a 0 r r input data register full indicates whether or not there is receive data in idr3. this is an internal interrupt source to the slave (this lsi). 0: there is not receive data in idr3 [clearing condition] when the slave reads idr3 1: there is receive data in idr3 [setting condition] when the host writes to idr3 in an i/o write cycle 0 obf3a 0 r/(w) * r output data register full indicates whether or not there is transmit data in odr3. 0: there is not transmit data in odr3 [clearing conditions] ? when the host reads odr3 in an i/o read cycle ? when the slave writes 0 to bit obf3a 1: there is transmit data in odr3 [setting condition] ? when the slave writes to odr3 note: * only 0 can be written to clear the flag.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 561 of 862 rej09b0429-0100 ? str3 (twre = 0 and selstr3 = 1) r/w bit bit name initial va lue slave host description 7 6 5 4 dbu37 dbu36 dbu35 dbu34 0 0 0 0 r/w r/w r/w r/w r r r r defined by user the user can use these bits as necessary. 3 c/ d 3 0 r r command/data flag when the host writes to idr3, bit 2 of the i/o address is written into this bit to indicate whether idr3 contains data or a command. 0: content of input data re gister (idr3) is a data 1: content of input dat a register (idr3) is a command 2 dbu32 0 r/w r defined by user the user can use this bit as necessary. 1 ibf3a 0 r r input data register full indicates whether or not there is receive data in idr3. this bit is an internal interrupt source to the slave (this lsi). 0: there is not receive data in idr3 [clearing condition] when the slave reads idr3 1: there is receive data in idr3 [setting condition] when the host writes to idr3 in an i/o write cycle
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 562 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 0 obf3a 0 r/(w) * r output data register full indicates whether or not there is transmit data in odr3. 0: there is not receive data in odr3 [clearing conditions] ? when the host reads odr3 in an i/o read cycle ? when the slave writes 0 to bit obf3a 1: there is receive data in odr3 [setting condition] ? when the slave writes to odr3 note: * only 0 can be written to clear the flag.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 563 of 862 rej09b0429-0100 18.3.12 serirq control register 0 (sirqcr0) sirqcr0 contains status bits that indicate the serirq operating mode and bits that specify serirq interrupt sources. r/w bit bit name initial va lue slave host description 7 q/ c 0 r ? quiet/continuous mode flag indicates the mode specifie d by the host at the end of an serirq transfer cycle (stop frame). 0: continuous mode [clearing conditions] ? lpc hardware reset, lpc software reset ? specification by serirq transfer cycle stop frame 1: quiet mode [setting condition] specification by serirq transfer cycle stop frame. 6 selreq 0 r/w ? start frame initiation request select selects the condition of a start frame initiation request when a host interrupt request is cleared in quiet mode. 0: start frame initiation is requested when all interrupt requests are cleared 1: start frame initiation is requested when one or more interrupt requests are cleared 5 iedir2 0 r/w ? interrupt enable direct mode specifies whether lpc channel 2 and channel 3 serirq interrupt source (smi, irq6, irq9 to irq11) generation is conditional upon obf, or is controlled only by the host interrupt enable bit. 0: host interrupt is requested when host interrupt enable and corresponding obf bits are both set to 1 1: host interrupt is requested when host interrupt enable bit is set to 1
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 564 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 4 smie3b 0 r/w ? host smi interrupt enable 3b enables or disables an smi interrupt request when obf3b is set by a twr15 write. 0: host smi interrupt request by obf3b and smie3b is disabled [clearing conditions] ? writing 0 to smie3b ? lpc hardware reset, lpc software reset ? clearing obf3b to 0 (when iedir3 = 0) 1: [when iedir3 = 0] host smi interrupt request by setting obf3b to 1 is enabled [when iedir3 = 1] host smi interrupt is requested [setting condition] writing 1 after reading smie3b = 0 3 smie3a 0 r/w ? host smi interrupt enable 3a enables or disables an smi interrupt request when obf3a is set by an odr3 write. 0: host smi interrupt request by obf3a and smie3a is disabled [clearing conditions] ? writing 0 to smie3a ? lpc hardware reset, lpc software reset ? clearing obf3a to 0 (when iedir3 = 0) 1: [when iedir3 = 0] host smi interrupt request by setting is enabled [when iedir3 = 1] host smi interrupt is requested [setting condition] writing 1 after reading smie3a = 0
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 565 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 2 smie2 0 r/w ? host smi interrupt enable 2 enables or disables an smi interrupt request when obf2 is set by an odr2 write. 0: host smi interrupt request by obf2 and smie2 is disabled [clearing conditions] ? writing 0 to smie2 ? lpc hardware reset, lpc software reset ? clearing obf2 to 0 (when iedir2 = 0) 1: [when iedir2 = 0] host smi interrupt request by setting obf2 to 1 is enabled [when iedir2 = 1] host smi interrupt is requested [setting condition] writing 1 after reading smie2 = 0 1 irq12e1 0 r/w ? host irq12 interrupt enable 1 enables or disables an hirq12 interrupt request when obf1 is set by an odr1 write. 0: hirq12 interrupt request by obf1 and irq12e1 is disabled [clearing conditions] ? writing 0 to irq12e1 ? lpc hardware reset, lpc software reset ? clearing obf1 to 0 1: hirq12 interrupt request by setting obf1 to 1 is enabled [setting condition] writing 1 after reading irq12e1 = 0
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 566 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 0 irq1e1 0 r/w ? host irq1 interrupt enable 1 enables or disables a host hirq1 interrupt request when obf1 is set by an odr1 write. 0: hirq1 interrupt request by obf1 and irq1e1 is disabled [clearing conditions] ? writing 0 to irq1e1 ? lpc hardware reset, lpc software reset ? clearing obf1 to 0 1: hirq1 interrupt request by setting obf1 to 1 is enabled [setting condition] writing 1 after reading irq1e1 = 0
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 567 of 862 rej09b0429-0100 18.3.13 serirq control register 1 (sirqcr1) sirqcr1 contains status bits that indicate the serirq operating mode and bits that specify serirq interrupt sources. r/w bit bit name initial va lue slave host description 7 irq11e3 0 r/w ? host irq11 interrupt enable 3 enables or disables an hirq11 interrupt request when obf3a is set by an odr3 write. 0: hirq11 interrupt request by obf3a and irqe11e3 is disabled [clearing conditions] ? writing 0 to irq11e3 ? lpc hardware reset, lpc software reset ? clearing obf3a to 0 (when iedir3 = 0) 1: [when iedir3 = 0] hirq11 interrupt request by setting obf3a to 1 is enabled [when iedir3 = 1] hirq11 interrupt is requested [setting condition] writing 1 after reading irq11e3 = 0 6 irq10e3 0 r/w ? host irq10 interrupt enable 3 enables or disables an hirq10 interrupt request when obf3a is set by an odr3 write. 0: hirq10 interrupt request by obf3a and irqe10e3 is disabled [clearing conditions] ? writing 0 to irq10e3 ? lpc hardware reset, lpc software reset ? clearing obf3a to 0 (when iedir3 = 0) 1: [when iedir3 = 0] hirq10 interrupt request by setting obf3a to 1 is enabled [when iedir3 = 1] hirq10 interrupt is requested [setting condition] writing 1 after reading irq10e3 = 0
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 568 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 5 irq9e3 0 r/w ? host irq9 interrupt enable 3 enables or disables an hirq9 interrupt request when obf3a is set by an odr3 write. 0: hirq9 interrupt request by obf3a and irqe9e3 is disabled [clearing conditions] ? writing 0 to irq9e3 ? lpc hardware reset, lpc software reset ? clearing obf3a to 0 (when iedir3 = 0) 1: [when iedir3 = 0] hirq9 interrupt request by setting obf3a to 1 is enabled [when iedir3 = 1] hirq9 interrupt is requested [setting condition] writing 1 after reading irq9e3 = 0 4 irq6e3 0 r/w ? host irq6 interrupt enable 3 enables or disables an hirq6 interrupt request when obf3a is set by an odr3 write. 0: hirq6 interrupt request by obf3a and irqe6e3 is disabled [clearing conditions] ? writing 0 to irq6e3 ? lpc hardware reset, lpc software reset ? clearing obf3a to 0 (when iedir3 = 0) 1: [when iedir3 = 0] hirq6 interrupt request by setting obf3a to 1 is enabled [when iedir3 = 1] hirq6 interrupt is requested [setting condition] writing 1 after reading irq6e3 = 0
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 569 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 3 irq11e2 0 r/w ? host irq11 interrupt enable 2 enables or disables an hirq11 interrupt request when obf2 is set by an odr2 write. 0: hirq11 interrupt request by obf2 and irqe11e2 is disabled [clearing conditions] ? writing 0 to irq11e2 ? lpc hardware reset, lpc software reset ? clearing obf2 to 0 (when iedir2 = 0) 1: [when iedir2 = 0] hirq11 interrupt request by setting obf2 to 1 is enabled [when iedir2 = 1] hirq11 interrupt is requested [setting condition] writing 1 after reading irq11e2 = 0 2 irq10e2 0 r/w ? host irq10 interrupt enable 2 enables or disables an hirq10 interrupt request when obf2 is set by an odr2 write. 0: hirq10 interrupt request by obf2 and irqe10e2 is disabled [clearing conditions] ? writing 0 to irq10e2 ? lpc hardware reset, lpc software reset ? clearing obf2 to 0 (when iedir2 = 0) 1: [when iedir2 = 0] hirq10 interrupt request by setting obf2 to 1 is enabled [when iedir2 = 1] hirq10 interrupt is requested [setting condition] writing 1 after reading irq10e2 = 0
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 570 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 1 irq9e2 0 r/w ? host irq9 interrupt enable 2 enables or disables an hirq9 interrupt request when obf2 is set by an odr2 write. 0: hirq9 interrupt request by obf2 and irqe9e2 is disabled [clearing conditions] ? writing 0 to irq9e2 ? lpc hardware reset, lpc software reset ? clearing obf2 to 0 (when iedir2 = 0) 1: [when iedir2 = 0] hirq9 interrupt request by setting obf2 to 1 is enabled [when iedir2 = 1] hirq9 interrupt is requested [setting condition] writing 1 after reading irq9e2 = 0 0 irq6e2 0 r/w ? host irq6 interrupt enable 2 enables or disables an hirq6 interrupt request when obf2 is set by an odr2 write. 0: hirq6 interrupt request by obf2 and irqe6e2 is disabled [clearing conditions] ? writing 0 to irq6e2 ? lpc hardware reset, lpc software reset ? clearing obf2 to 0 (when iedir2 = 0) 1: [when iedir2 = 0] hirq6 interrupt request by setting obf2 to 1 is enabled [when iedir2 = 1] hirq6 interrupt is requested [setting condition] writing 1 after reading irq6e2 = 0
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 571 of 862 rej09b0429-0100 18.3.14 serirq control register 2 (sirqcr2) sirqcr2 contains bits that enable or disable serirq interrupt requests and select the host interrupt request outputs. r/w bit bit name initial va lue slave host description 7 iedir3 0 r/w ? interrupt enable direct mode 3 selects whether an serirq interrupt generation of lpc channel 3 is affected only by a host interrupt enable bit or by an obf flag in addition to the enable bit. 0: a host interrupt is generated when both the enable bit and the corresponding obf flag are set 1: a host interrupt is generated when the enable bit is set 6 to 0 ? all 0 r/w ? reserved the initial value should not be changed.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 572 of 862 rej09b0429-0100 18.3.15 serirq control register 3 (sirqcr3) sirqcr3 selects the serirq inte rrupt requests of the scif. r/w bit bit name initial value slave host description 7 to 4 ? all 0 r/w ? reserved the initial value should not be changed. 3 2 1 0 scsirq3 scsirq2 scsirq1 scsirq0 0 0 0 0 r/w r/w r/w r/w ? ? ? ? scif serirq interrupt select these bits select the scif interrupt request to the host. 0000: no interrupt request to the host 0001: hirq1 0010: smi 0011: hirq3 0100: hirq4 0101: hirq5 0110: hirq6 0111: hirq7 1000: hirq8 1001: hirq9 1010: hirq10 1011: hirq11 1100: hirq12 1101: hirq13 1110: hirq14 1111: hirq15
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 573 of 862 rej09b0429-0100 18.3.16 serirq control register 4 (sirqcr4) sirqcr4 controls lpc interrupt requests to the host. r/w bit bit name initial value slave host description 7 irq15e 0 r/w ? host irq15 interrupt enable 0: disables hirq15 interrupt request by irq15e 1: enables hirq15 interrupt request 6 irq14e 0 r/w ? host irq14 interrupt enable 0: disables hirq14 interrupt request by irq14e 1: enables hirq14 interrupt request 5 irq13e 0 r/w ? host irq13 interrupt enable 0: disables hirq13 interrupt request by irq13e 1: enables hirq13 interrupt request 4 irq8 0 r/w ? host irq8 interrupt enable 0: disables hirq8 interrupt request by irq8e 1: enables hirq8 interrupt request 3 irq7 0 r/w ? host irq7 interrupt enable 0: disables hirq7 interrupt request by irq7e 1: enables hirq7 interrupt request 2 irq5 0 r/w ? host irq5 interrupt enable 0: disables hirq5 interrupt request by irq5e 1: enables hirq5 interrupt request 1 irq4 1 r/w ? host irq4 interrupt enable 0: disables hirq4 interrupt request by irq4e 1: enables hirq4 interrupt request 0 irq3 1 r/w ? host irq3 interrupt enable 0: disables hirq3 interrupt request by irq3e 1: enables hirq3 interrupt request
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 574 of 862 rej09b0429-0100 18.3.17 serirq control register 5 (sirqcr5) sirqcr5 selects the output of the host interrupt request signal of each frame. r/w bit bit name initial value slave host description 7 6 5 4 3 2 1 0 selirq15 selirq14 selirq13 selirq8 selirq7 selirq5 selirq4 selirq3 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w ? ? ? ? ? ? ? ? serirq output select these bits select the state of the output on the pin for lpc host interrupt requests (hirq15, hirq14, hirq13, hirq8, hirq7, hirq5, hirq4, and hirq3). 0: [when host interrupt request is cleared] serirq pin output is in the hi-z state [when host interrupt request is set] serirq pin output is low 1: [when host interrupt request is cleared] serirq pin output is low [when host interrupt request is set] serirq pin output is in the hi-z state.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 575 of 862 rej09b0429-0100 18.3.18 host interface select register (hisel) hisel selects the function of bits 7 to 4 in str3 and selects the output of the host interrupt request signal of each frame. r/w bit bit name initial value slave host description 7 selstr3 0 r/w ? status register 3 selection selects the function of bits 7 to 4 in str3 in combination with the twre bit in ladr3l. for details of str3, see se ction 18.3.11, status registers 1 to 3 (str1 to str3). 0: bits 7 to 4 in str3 indicate processing status of the lpc interface. 1: [when twre = 1] bits 7 to 4 in str3 indicate processing status of the lpc interface. [when twre = 0] bits 7 to 4 in str3 are readable/writable bits which user can use as necessary 6 5 4 3 2 1 0 selirq11 selirq10 selirq9 selirq6 selsmi selirq12 selirq1 0 0 0 0 0 1 1 r/w r/w r/w r/w r/w r/w r/w ? ? ? ? ? ? ? host irq interrupt select these bits select the st ate of the output on the serirq pin. 0: [when host interrupt request is cleared] serirq pin output is in the hi-z state [when host interrupt request is set] serirq pin output is low 1: [when host interrupt request is cleared] serirq pin output is low [when host interrupt request is set] serirq pin output is in the hi-z state.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 576 of 862 rej09b0429-0100 18.3.19 scif address regi ster (scifadrh, scifadrl) scifadr sets the host address for the scif. do not change the contents of scifadr while the scif is operating (i.e. while scife is set to 1). ? scifadrh r/w bit bit name initial value slave host description 7 ? 0 r/w ? 6 ? 0 r/w ? 5 ? 0 r/w ? 4 ? 0 r/w ? 3 ? 0 r/w ? 2 ? 0 r/w ? 1 ? 1 r/w ? 0 ? 1 r/w ? scif address 15 to 8 these bits set the host address for the scif. ? scifadrl r/w bit bit name initial value slave host description 7 ? 1 r/w ? 6 ? 1 r/w ? 5 ? 1 r/w ? 4 ? 1 r/w ? 3 ? 1 r/w ? 2 ? 0 r/w ? 1 ? 0 r/w ? 0 ? 0 r/w ? scif address 15 to 8 these bits set the host address for the scif. note: when the scif is in use, scifadr must be set to an address that is different from those for lpc channels 1, 2, and 3.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 577 of 862 rej09b0429-0100 18.3.20 smic flag register (smicflg) smicflg is one of the registers used to implemen t smic mode. this register includes bits that indicate whether or not the system is ready to data transfer and those that are used for handshake of the transfer cycles. r/w bit bit name initial va lue slave host description 7 rx_data_rdy 0 r/w r read transfer ready indicates whether or not the slave is ready for the host read transfer. 0: slave waits for ready status 1: slave is ready for the host read transfer 6 tx_data_rdy 0 r/w r write transfer ready indicates whether or not the slave is ready for the host next write transfer. 0: the slave waits for ready status 1: the slave is ready for the host write transfer. 5 ? 0 r/w r reserved the initial value should not be changed. 4 smi 0 r/w r smi flag this bit indicates that the smi is asserted. 0: indicates waiting for smi assertion 1: indicates smi assertion 3 sevt_atn 0 r/w r event flag when the slave detects an event for the host, this bit is set. 0: indicates waiting for event detection 1: indicates event detection 2 sms_atn 0 r/w r sms flag when there is a message to be transmitted from the slave to the host, this bit is set. 0: there is not a message 1: there is a message
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 578 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 1 ? 0 r/w r reserved the initial value should not be changed. 0 busy 0 r/(w) * w smic busy this bit indicates that the slave is now transferring data. this bit can be cleared only by the slave and set only by the host. the rising edge of this bit is a source of internal interrupt to the slave. 0: transfer cycle wait state [clearing conditions] after the slave reads busy = 1, writes 0 to this bit. 1: transfer cycle in progress [setting condition] when the host writes 1 to this bit. note: only 0 can be written to clear the flag. 18.3.21 smic control st atus register (smiccsr) smiccsr is one of the registers used to implement smic mode. this is an 8-bit readable/writable register that stor es a control code issued from the host and a status code that is returned from the slave. the control code is written to this register accomp anied by the transfer betw een the host and slave. the status code is returned to this register to indicate that the slave has recognized the control code, and a specified transfer cycle has been completed. 18.3.22 smic data register (smicdtr) smicdtr is one of the registers used to implement smic mode. this is an 8-bit register that is accessible (readable/writable) from bo th the slave processor (this lsi) and host processor. this is used for data transfer between the host and slave.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 579 of 862 rej09b0429-0100 18.3.23 smic interrup t register 0 (smicir0) smicir0 is one of the registers used to implement smic mode. this register includes the bits that indicate the source of in terrupt to the slave. r/w bit bit name initial va lue slave host description 7 to 5 ? all 0 r/w ? reserved the initial value should not be changed. 4 hdtwi 0 r/(w) * ? transfer data transmission end interrupt this is a status flag that indicates that the host has finished transmitting the transfer data to smicdtr. when the ibfie3 bit and hdtwie bit are set to 1, the ibfi3 interrupt is requested to the slave. 0: transfer data transmission wait state [clearing condition] after the slave reads hdtwi = 1, writes 0 to this bit. 1: transfer data transmission end [setting condition] the transfer cycle is write transfer and the host writes the transfer data to smicdtr. 3 hdtri 0 r/(w) * ? transfer data receive end interrupt this is a status flag that indicates that the host has finished receiving the transfer data from smicdtr. when the ibfie3 bit and hdtrie bit are set to 1, the ibfi3 interrupt is requested to the slave. 0: transfer data receive wait state [clearing condition] after the slave reads hdtri = 1, writes 0 to this bit. 1: transfer data receive end [setting condition] the transfer cycle is read transfer and the host reads the transfer data from smicdtr.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 580 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 2 stari 0 r/(w) * ? status code receive end interrupt this is a status flag that indicates that the host has finished receiving the status code from smiccsr. when the ibfie3 bit and starie bit are set to 1, the ibfi3 interrupt is requested to the slave. 0: status code receive wait state [clearing condition] after the slave reads stari = 1, writes 0 to this bit. 1: status code receive end [setting condition] when the host reads the stat us code of smiccsr. 1 ctlwi 0 r/(w) * ? control code transmission end interrupt this is a status flag that indicates that the host has finished transmitting the control code to smiccsr. when the ibfie3 bit and ctlwie bit are set to1, the ibfi3 interrupt is requested to the slave. 0: control code transmission wait state [clearing condition] after the slave reads ctlwi = 1, writes 0 to this bit. 1: control code transmission end [setting condition] when the host writes the st atus code to smiccsr. 0 busyi r/(w) * ? transfer start interrupt this is a status flag that i ndicates that the host starts transferring. when the ibfie3 bit and busyie bit are set to 1, the ibfi3 interrupt is requested to the slave. 0: transfer start wait state [clearing condition] after the slave reads busyi = 1, writes 0 to this bit. 1: transfer start [setting condition] when the rising edge of the busy bit in smicflg is detected. note: * only 0 can be written to clear the flag.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 581 of 862 rej09b0429-0100 18.3.24 smic interrup t register 1 (smicir1) smicir1 is one of the registers used to implement smic mode. this register includes the bits that enables/disables an interrupt to the slave. the ib fi3 interrupt is enabled by setting the ibfie3 bit in hicr2 to 1. r/w bit bit name initial va lue slave host description 7 to 5 ? all 0 r/w ? reserved the initial value should not be changed. 4 hdtwie 0 r/w ? transfer data transmission end interrupt enable enables or disables hdtwi interrupt that is ibfi3 interrupt source to the slave. 0: disables transfer data transmission end interrupt 1: enables transfer data transmission end interrupt 3 hdtrie 0 r/w ? transfer data receive end interrupt enable enables or disables hdtri interrupt that is ibfi3 interrupt source to the slave. 0: disables transfer data receive end interrupt 1: enables transfer data receive end interrupt 2 starie 0 r/w ? status code receive end interrupt enable enables or disables stari interrupt that is ibfi3 interrupt source to the slave. 0: disables status code receive end interrupt 1: enables status code receive end interrupt 1 ctlwie 0 r/w ? control code transmission end interrupt enable enables or disables ctlwi interrupt that is ibfi3 interrupt source to the slave. 0: disables control code transmission end interrupt 1: enables control code transmission end interrupt 0 busyie 0 r/w ? transfer start interrupt enable enables or disables busyi interrupt that is ibfi3 interrupt source to the slave. 0: disables transfer start interrupt 1: enables transfer start interrupt
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 582 of 862 rej09b0429-0100 18.3.25 bt status register 0 (btsr0) btsr0 is one of the registers used to implement bt mode. this register includes flags that control interrupts to the slave (this lsi). r/w bit bit name initial va lue slave host description 7 to 5 ? all 0 r/w ? reserved the initial value should not be changed. 4 frdi 0 r/(w) * ? fifo read request interrupt this status flag indicates that host writes the data to btdtr buffer with fifo full state at the host write transfer. when the ibfie3 bit and frdie bit are set to 1, ibfi3 interrupt is r equested to the slave. the slave must clear the flag after creating an unused area by reading the data in fifo. 0: fifo read is not requested [clearing condition] after the slave reads frdi = 1, writes 0 to this bit. 1: fifo read is requested [setting condition] after the host processor transfers data, the host writes the data with fifo full state. 3 hrdi 0 r/(w) * ? bt host read interrupt this status flag indicates that the host reads 1 byte from btdtr buffer. when the ibfie3 bit and hrdie bit are set to 1, ibfi3 interrupt is requested to the slave. 0: host btdtr read wait state [clearing condition] after the slave reads hrdi = 1, writes 0 to this bit. 1: the host reads from btdtr [setting condition] the host reads one byte from btdtr.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 583 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 2 hwri 0 r/(w) * ? bt host write interrupt this status flag indicates that the host writes 1byte to btdtr buffer. when the ibfie3 bit and hwrie bit are set to 1, ibfi3 interrupt is requested to the slave. 0: host btdtr wr ite wait state [clearing condition] after the slave reads hwri = 1, writes 0 to this bit. 1: the host writes to btdtr [setting condition] the host writes one byte to btdtr. 1 hbtwi 0 r/(w) * ? btdtr host write start interrupt this status flag indicates that the host writes the first byte of valid data to btdtr buffer. when the ibfie3 bit and hbtwie bit are set to 1, ibfi3 interrupt is requested to the slave. 0: btdtr host write start wait state [clearing condition] after the slave reads hbtwi = 1 and writes 0 to this bit. 1: btdtr host write start [setting condition] the host starts writing valid data to btdtr.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 584 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 0 hbtri 0 r/(w) * ? btdtr host read end interrupt this status flag indicates that the host reads all valid data from btdtr buffer. when the bfie3 bit and hbtrie bit are set to 1, ibfi3 interrupt is requested to the slave. 0: btdtr host read end wait state [clearing condition] after the slave reads hbtri = 1 and writes 0 to this bit. 1: btdtr host read end [setting condition] when the host finished reading the valid data from btdtr. note: * only 0 can be written to clear the flag.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 585 of 862 rej09b0429-0100 18.3.26 bt status register 1 (btsr1) btsr1 is one of the registers used to implement th e bt mode. this register includes a flag that controls an interrupt to the slave (this lsi). r/w bit bit name initial va lue slave host description 7 ? 0 r/w ? reserved the initial value should not be changed. 6 hrsti 0 r/(w) * ? bt reset interrupt this status flag indicates that the bmc_hwrst bit in btimsr is set to 1 by the host. when the ibfie3 bit and hrstie bit are set to 1, ibfi3 interrupt is requested to the slave. 0: [clearing condition] when the slave reads hrsti = 1 and writes 0 to this bit. 1: [setting condition] when the slave detects the rising edge of bmc_hwrst. 5 irqcri 0 r/(w) * ? b2h_irq clear interrupt this status flag indicates that the b2h_irq bit in btimsr is cleared by the host. when the ibfie3 bit and irqcrie bit are set to 1, ibfi3 interrupt is requested to the slave. 0: [clearing condition] when the slave reads irqcri = 1 and writes 0 to this bit. 1: [setting condition] when the slave detects the falling edge of b2h_irq.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 586 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 4 bevti 0 r/(w) * ? bevt_atn clear interrupt this status flag indicate s that the bevt_atn bit in btcr is cleared by the host. when the ibfie3 bit and bevtie bit are set to 1, ibfi3 interrupt is requested to the slave. 0: [clearing condition] when the slave reads bevti = 1 and writes 0 to this bit. 1: [setting condition] when the slave detects the falling edge of bevt_atn. 3 b2hi 0 r/(w) * ? read end interrupt this status flag indicates that the host has finished reading all data from t he btdtr buffer. when the ibfie3 bit and b2hie bit are set to 1, the ibfi3 interrupt is requested to the slave. 0: [clearing condition] when the slave reads b2hi = 1 and writes 0 to this bit. 1: [setting conditions] when the slave detects the falling edge of b2h_atn. 2 h2bi 0 r/(w) * ? write end interrupt this status flag indicates that the host has finished writing all data to the btdtr buffer. when the ibfie3 bit and h2bie bit are set to 1, the ibfi3 interrupt is requested to the slave. 0: [clearing condition] after the slave reads h2bi = 1, writes 0 to this bit. 1: [setting condition] when the slave detects the falling edge of h2b_atn.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 587 of 862 rej09b0429-0100 r/w bit bit name initial va lue slave host description 1 crrpi 0 r/(w) * ? read pointer clear interrupt this status flag indicates that the clr_rd_ptr bit in btcr is set to 1 by the host. when the ibfie3 bit and crrpie bit are set to 1, the ibfi3 interrupt is requested to the slave. 0: [clearing condition] after the slave reads crrpi = 1, writes 0 to this bit. 1: [setting condition] when the slave detects the rising edge of clr_rd_ptr. 0 crwpi 0 r/(w) * ? write pointer clear interrupt this status flag indicates that the clr_wr_ptr bit in btcr is set to 1 by the host. when the ibfie3 bit and crwpie bit are set to 1, the ibfi3 interrupt is requested to the slave. 0: [clearing condition] after the slave reads crwpi = 1, writes 0 to this bit. 1: [setting condition] when the slave detects the rising edge of clr_wr_ptr. note: * only 0 can be written to clear the flag.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 588 of 862 rej09b0429-0100 18.3.27 bt control status register 0 (btcsr0) btcsr0 is one of the registers used to implem ent the bt mode. the btcsr0 register contains the bits used to switch fifos in bt transfer, and en able or disable the interrupts to the slave (this lsi). the ibfi3 interrupt is enabled by setting the ibfie3 bit in hicr2 to 1. r/w bit bit name initial valu e slave host description 7 ? 0 r/w ? reserved the initial value should not be changed. 6 5 fsel1 fsel0 0 0 r/w r/w ? ? these bits select either fifo during bt transfer fsel1 fsel0 0 x :fifo disabled 1 x :fifo enabled the fifo size: 64 bytes (f or host write transfer), additional 64 bytes (for host read transfer). 4 frdie 0 r/w ? fifo read request interrupt enable enables or disables the frdi interrupt which is an ibfi3 interrupt source to the slave. 0: fifo read request interrupt is disabled. 1: fifo read request interrupt is enabled. 3 hrdie 0 r/w ? bt host read interrupt enable enables or disables the hrdi interrupt which is an ibfi3 interrupt source to the slave. when using fifo, the hrdie bit must not be set to 1. 0: bt host read interrupt is disabled. 1: bt host read interrupt is enabled. 2 hwrie 0 r/w ? bt host write interrupt enable enables or disables the hwri interrupt which is an ibfi3 interrupt source to the slave. when using fifo, the hwrie bit must not be set to 1. 0: bt host write interrupt is disabled. 1: bt host write interrupt is enabled.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 589 of 862 rej09b0429-0100 r/w bit bit name initial valu e slave host description 1 hbtwie 0 r/w ? btdtr host write start interrupt enable enables or disables the hbtwi interrupt which is an ibfi3 interrupt source to the slave. 0: btdtr host write start interrupt is disabled. 1: btdtr host write start interrupt is enabled. 0 hbtrie 0 r/w ? btdtr host read end interrupt enable enables or disables the hbtri interrupt which is an ibfi3 interrupt source to the slave. 0: btdtr host read end interrupt is disabled. 1: btdtr host read end interrupt is enabled. note: x don't care. 18.3.28 bt control status register 1 (btcsr1) btcsr1 is one of the registers used to implem ent the bt mode. the btcsr1 register contains the bits used to enable or disable interrupts to the slave (this lsi). the ibfi3 interrupt is enabled by setting the ibfie3 bit in hicr2 to 1. r/w bit bit name initial valu e slave host description 7 rstrenbl 0 r/w ? slave reset read enable the host reads 0 from the bmc_hwrst bit in btimsr. when this bit is set to 1, the host can read 1 from the bmc_hwrst bit. 0: host always reads 0 from bmc_hwrst 1: host can reads 0 from bmc_hwrst 6 hrstie 0 r/w ? bt reset interrupt enable enables or disables the hrsti interrupt which is an ibfi3 interrupt source to the slave. 0: bt reset interrupt is disabled. 1: bt reset interrupt is enabled.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 590 of 862 rej09b0429-0100 r/w bit bit name initial valu e slave host description 5 irqcrie 0 r/w ? b2h_irq clear in terrupt enable enables or disables the irqcri interrupt which is an ibfi3 interrupt source to the slave. 0: b2h_irq clear inte rrupt is disabled. 1: b2h_irq clear interrupt is enabled. 4 bevtie 0 r/w ? bevt_atn clear interrupt enable enables or disables the bevti interrupt which is an ibfi3 interrupt source to the slave. 0: bevt_atn clear interrupt is disabled. 1: bevt_atn clear interrupt is enabled. 3 b2hie 0 r/w ? read end interrupt enable enables or disables the b2hi interrupt which is an ibfi3 interrupt source to the slave. 0: read end interrupt is disabled. 1: read end interrupt is enabled. 2 h2bie 0 r/w ? write end interrupt enable enables or disables the h2bi interrupt which is an ibfi3 interrupt source to the slave. 0: write end interrupt is disabled. 1: write end interrupt is enabled. 1 crrpie 0 r/w ? read pointer clear interrupt enable enables or disables the crrpi interrupt which is an ibfi3 interrupt source to the slave. 0: read pointer clear interrupt is disabled. 1: read pointer clear interrupt is enabled. 0 crwpie 0 r/w ? write pointer clear interrupt enable enables or disables the crwpi interrupt which is an ibfi3 interrupt source to the slave. 0: write pointer clear interrupt is disabled. 1: write pointer clear interrupt is enabled.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 591 of 862 rej09b0429-0100 18.3.29 bt control register (btcr) btcr is one of the registers used to implement bt mode. the btcr register contains bits used in transfer cycle handshaking, and those indicating the completion of data transfer to the buffer. r/w bit bit name initial valu e slave host description 7 b_busy 1 r/w r bt write transfer busy flag read-only bit from the host. indicates that the btdtr buffer is being used for bt write transfer (write transfer is in progress.) 0: indicates waiting for bt write transfer 1: indicates that the btdtr buffer is being used 6 h_busy 0 r (w) * 3 bt read transfer busy flag this is a set/clear bit fr om the host. indicates that the btdtr buffer is being used for bt read transfer (read transfer is in progress.) 0: indicates waiting for bt read transfer [clearing condition] when the host writes a 1 while h_busy is set to 1. 1: indicates that the btdtr buffer is being used [setting condition] when the host writes a 1 while h_busy is set to 0. 5 oem0 0 r/w r/(w) * 4 user defined bit this bit is defined by the user, and validated only when set to 1 by a 0 written from the host. 0: [clearing condition] when the slave writes a 0 after a 1 has been read from oem0. 1: [setting condition] when the slave writes a 1, after a 0 has been read from oem0, or when the host writes a 0.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 592 of 862 rej09b0429-0100 r/w bit bit name initial valu e slave host description 4 bevt_atn 0 r/(w) * 1 r/(w) * 5 event interrupt sets when the slave detects an event to the host. setting the b2h_irq_en bit in the btimsr register enables the bevt _atn bit to be used as an interrupt source to the host. 0: no event interrupt request is available [clearing condition] when the host writes a 1 to the bit. 1: an event interrupt request is available [setting condition] when the slave writes a 1 after a 0 has been read from bevt_atn. 3 b2h_atn 0 r/(w) * 1 r/(w) * 5 slave buffer write end indication flag this status flag indicates that the slave has finished writing all data to the btdtr buffer. setting the b2h_irq_en bit in the btimsr register enables the b2h_atn bit to be used as an interrupt source to the host. 0: host has completed reading the btdtr buffer [clearing condition] when the host writes a 1 1: slave has completed writing to the btdtr buffer [setting condition] when the slave writes a 1 after a 0 has been read from b2n_atn. 2 h2b_atn 0 r/(w) * 2 r/(w) * 1 host buffer write end indication flag this status flag indicates that the host has finished writing all data to the btdtr buffer. 0: slave has completed reading the btdtr buffer [clearing condition] when the slave writes a 0 after a 1 has been read from h2b_atn. 1: host has completed writing to the btdtr buffer [setting condition] when the host writes a 1
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 593 of 862 rej09b0429-0100 r/w bit bit name initial valu e slave host description 1 clr_rd_ ptr 0 r/(w) * 2 (w) * 1 read pointer clear this bit is used by the host to clear the read pointer during read transfer. a host read operation always yields 0 on readout. 0: read pointer clear wait [clearing condition] when the slave writes a 0 after a 1 has been read from clr_rd_ptr. 1: read pointer clear [setting condition] when the host writes a 1. 0 clr_wr_ ptr 0 r/(w) * 2 (w) * 1 write pointer clear this bit is used by the host to clear the write pointer during write transfer. a host read operation always yields 0 on readout. 0: write pointer clear wait [clearing condition] when the slave writes a 0 after a 1 has been read from clr_wr_ptr. 1: write pointer clear [setting condition] when the host writes a 1. notes: 1. only 1 can be written to set this flag. 2. only 0 can be written to clear this flag. 3. only 1 can be written to toggle this flag. 4. only 0 can be written to set this flag. 5. only 1 can be written to clear this flag.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 594 of 862 rej09b0429-0100 18.3.30 bt data buffer (btdtr) btdtr is used to implement the bt mode. btdtr consists of two fifos: the host write transfer fifo and the host read transf er fifo. their capacities are 64 bytes each. when using btdtr, enable fifo by means of the bits fsel0 and fsel1. r/w bit bit name initial valu e slave host description 7 to 0 bit7 to bit0 undefined r/w r/w the data wr itten by the host is stored in fifo (64 bytes) for host write transfer and read out by the slave in order of host writ ing. the data written by the slave is stored in fifo (64 bytes) for host read transfer and read out by the host in order of slave writing. 18.3.31 bt interrupt mask register (btimsr) btimsr is one of the registers used to implem ent bt mode. the btimsr register contains the bits used to control the interrupts to the host. r/w bit bit name initial valu e slave host description 7 bmc_ hwrst 0 r/(w) * 2 r/(w) * 1 slave reset performs a reset from the host to the slave. the host can only write a 1. writing a 0 to this bit is invalid. the host will always return a 0 on read out. setting the rstrenbl bit enables a 1 to be read from the host. 0: the reset is cancelled [clearing condition] when the slave writes a 0, after a 1 has been read from bmc_hwrst. 1: the reset is in progress. [setting condition] when the host writes a 1. 6 5 ? ? 0 0 r/w r/w r/w r/w reserved
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 595 of 862 rej09b0429-0100 r/w bit bit name initial valu e slave host description 4 3 2 oem3 oem2 oem1 0 0 0 r/w r/w r/w r/(w) * 4 r/(w) * 4 r/(w) * 4 user defined bit these bits are defined by the user and are valid only when set to 1 by a 0 written from the host. 0: [clearing condition] when the slave writes a 0, after a 1 has been read from oem. 1: [setting condition] when the slave writes a 1, after a 0 has been read from oem, or when the host writes a 0. 1 b2h_irq 0 r/(w) * 1 r/(w) * 3 bmc to host interrupt informs the host that an interrupt has been requested when the bevt_atn or b2h_atn bit has been set. the serirq is not issued. to generate the serirq, it should be issued by the program. 0: b2h_irq interrupt is not requested [clearing condition] when the host writes a 1. 1: b2h_irq interrupt is requested [setting condition] when the slave writes a 1, after a 0 has been read from b2h_irq 0 b2h_irq_en 0 r r/w bmc to host interrupt enable enables or disables the b2h_irq interrupt which is an interrupt source from the slave to the host. 0: b2h_irq interrupt is disabled [clearing condition] when a 0 is written by the host. 1: b2h_irq interrupt is enabled [setting condition] when a 1 is written by the host. notes: 1. only 1 can be written to set this flag. 2. only 0 can be written to clear this flag. 3. only 1 can be written to clear this flag. 4. only 0 can be written to set this flag.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 596 of 862 rej09b0429-0100 18.3.32 bt fifo valid size register 0 (btfvsr0) btfvsr0 is one of the registers used to implement bt mode. btfvsr0 indicates a valid data size in the fifo for host write transfer. r/w bit bit name initial va lue slave host description 7 to 0 n7 to n0 all 0 r ? these bits indicate the number of valid bytes in the fifo (the number of bytes which the slave can read) for host write transfer. when data is written from the host, the value in btfvsr0 is incremented by the number of bytes that have been written to. further, when data is read from the slave, the value is decremented by only the num ber of bytes that have been read. 18.3.33 bt fifo valid size register 1 (btfvsr1) btfvsr1 is one of the registers used to implement bt mode. btfvsr1 indicates a valid data size in the fifo for host read transfer. r/w bit bit name initial va lue slave host description 7 to 0 n7 to n0 all 0 r ? these bits indicate the number of valid bytes in the fifo (the number of bytes which the host can read) for host read transfer. when data is written from the slave, the value in btfvsr 1 is incremented by the number of bytes that have been written to. further, when data is read from the host, the value is decremented by only the num ber of bytes that have been read.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 597 of 862 rej09b0429-0100 18.4 operation 18.4.1 lpc interface activation the lpc interface is activated by setting any one of bits lpc3e to lp c1e in hicr0 and bit sicie bit in hicr5 to 1. when the lpc interface is activated, the related i/o port pins (pe7 to pe0, pd5 and pd4) function as de dicated lpc interface input/output pins. in additi on, setting the fga20e, pmee, lsmie, and lscie bits to 1 adds the related i/o port pins (pd3 to pd0) to the lpc interface's input/output pins. use the following procedure to activate the lpc interface after a reset release. 1. read the signal line status and confirm that the lpc module can be connected. also check that the lpc module is initialized internally. 2. when using channels 1 and 2, set ladr1 and ladr2 to determine the i/o address. 3. when using channel 3, set ladr3 to determine the i/o address and whether bidirectional data registers are to be used. 4. when using the scif module, set sc ifar to determine the i/o address. 5. set the enable bit (lpc3e to lpc1e) for the ch annel to be used. also set scife if the scif is to be used. 6. set the enable bits (fga20e, pmee, lsmie, and lscie) for the additional functions to be used. 7. set the selection bits for other functions (sdwne, iedir). 8. as a precaution, clear the interrupt flags (l rst, sdwn, abrt, obf, and obei). read idr or twr15 to clear ibf. 9. set receive complete interr upt enable bits (ibfie3 to ib fie1, and errie) as necessary. 18.4.2 lpc i/o cycles there are 12 types of lpc transfer cycle: lpc memory read, lpc memory write, i/o read, i/o write, dma read, dma write, bus master memory re ad, bus master memory write, bus master i/o read, bus master i/o write, fw memory read, and fw memory write. of these, the lpc of this lsi supports i/o read and i/o write.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 598 of 862 rej09b0429-0100 an lpc transfer cycle is started when the lframe signal goes low in the bus idle state. if the lframe signal goes low when the bus is not idle, this means that a forced termination (abort) of the lpc transfer cycle has been requested. in an i/o read cycle or i/o write cycle, transf er is carried out using lad3 to lad0 in the following order, in synchronization with lclk. the host can be made to wait by sending back a value other than b'0000 in the slave's synchronization return cycl e, but the lpc interface of this lsi always returns b'0000 (e xcept for the bt interface). if the received address matches the host address fo r an lpc register, the lpc interface enters the busy state; it returns to the idle state by output of a state count 12 turnaround. register and flag changes are made at this timing, so in the event of a transfer cy cle forced termination (abort), registers and flags are not changed. the timing of the lframe , lclk, and lad signals is shown in figures 18.2 and 19.3. table 18.5 lpc i/o cycle i/o read cycle i/o write cycle state count contents drive source value (3 to 0) contents drive source value (3 to 0) 1 start host 0000 start host 0000 2 cycle type/direction host 0000 cycle type/direction host 0010 3 address 1 host bits 15 to 12 address 1 host bits 15 to 12 4 address 2 host bits 11 to 8 address 2 host bits 11 to 8 5 address 3 host bits 7 to 4 address 3 host bits 7 to 4 6 address 4 host bits 3 to 0 address 4 host bits 3 to 0 7 turnaround (recovery) host 1111 data 1 host bits 3 to 0 8 turnaround none zzzz data 2 host bits 7 to 4 9 synchronization slave 0000 turnaround (recovery) host 1111 10 data 1 slave bits 3 to 0 turnaround none zzzz 11 data 2 slave bits 7 to 4 synchronization slave 0000 12 turnaround (recovery) slave 1111 turnaround (recovery) slave 1111 13 turnaround none zzzz turnaround none zzzz
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 599 of 862 rej09b0429-0100 addr start lframe lad3 to lad0 number of clocks lclk tar sync data tar start cycle type, direction, and size 114 1 2221 figure 18.2 typical lframe timing addr start lframe lad3 to lad0 lclk tar sync cycle type, direction, and size slave must stop driving too many syncs cause timeout master will drive high figure 18.3 abort mechanism 18.4.3 smic mode transfer flow figure 18.4 shows the write transfer flow and figu re 18.5 shows th e read transfer flow in smic mode.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 600 of 862 rej09b0429-0100 wait for busy = 0 wait for tx_data_rdy = 1 host confirms the busy bit in smicflg. the bit indicates slave (this lsi) is ready for receiving a new control code. when busy = 1, access from host is disabled. slave confirms the rising edge of the busy bit in smicflg. the busyi bit in smicir0 is set. host confirms the falling edge of the busy bit in smicflg. an interrupt is generated. slave clears the tx_data_rdy bit in smicflg. host confirms the tx_data_rdy bit in smicflg. the confirmation is unnecessary when write start control is issued. host writes the write control code in smiccsr. host writes transfer data in smicdtr. slave reads transfer data in smicdtr according to write control code. slave writes the status code to smiccsr to notify the processing completion status. slave clears the busy bit in smicflg to indicate transfer completion. slave confirms that status code is read from smiccsr by host. the stari bit in smicir0 is set. slave confirms that valid data is written to smicdtr by host. the hdtwi bit in smicir0 is set. slave reads the control code in smiccsr. host confirms the status code in smiccsr. in the case of normal completion, the status code is reflected to the next step. in the case of abnormal completion, the status code is ready and an error is kept. host sets the busy bit in smicflg. write control code write transfer data busy = 1 tx_data_rdy = 0 write status code busy = 0 generate slave interrupt generate host interrupt generate slave interrupt generate slave interrupt generate slave interrupt normal abnormal read control code read transfer data read status code a a bit that indicates slave is ready for write transfer. issues when slave is ready for the next write transfer. host slave slave waits for the busy bit in smicflg is set. slave confirms that control code is written to smiccsr by host. the ctlwi bit in smicir0 is set. figure 18.4 smic write transfer flow
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 601 of 862 rej09b0429-0100 wait for busy = 0 waits for rx_data_rdy = 1 host confirms the busy bit in smicflg. the bit indicates slave (this lsi) is ready for receiving a new control code. when busy = 1, access from host is disabled. slave confirms the rising edge of the busy bit in smicflg. the busyi bit in smicir0 is set. host confirms the falling edge of the busy bit in smicflg. an interrupt is generated. slave clears the rx_data_rdy bit in smicflg. host confirms the rx_data_rdy bit in smicflg. host writes the read control code to smiccsr. slave writes transfer data to smicdtr according to read control code. host reads transfer data in smicdtr. slave writes the status code to smiccsr to notify the processing completion status. slave clears the busy bit in smicflg to indicate transfer completion. slave confirms that status code is read from smiccsr by host. the stari bit in smicir0 is set. slave confirms that valid data is read from smicdtr by host. the hdtri bit in smicir0 is set. slave confirms that control code is written to smiccsr by host. the ctlwi bit in smicir0 is set. slave reads the control code in smiccsr. host confirms the status code in smiccsr. in the case of normal completion, the status code is reflected to the next step. in the case of abnormal completion, the status code is ready and an error is kept. host sets the busy bit in smicflg. write control code busy = 1 rx_data_rdy = 0 write status code busy = 0 generate slave interrupt generate host interrupt generate slave interrupt generate slave interrupt generate slave interrupt read control code write transfer data read transfer data read status code a a bit that indicates slave is ready for read transfer. issues when slave is ready for the next read transfer. slave waits for the busy bit in smicflg is set. normal abnormal host slave figure 18.5 smic read transfer flow
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 602 of 862 rej09b0429-0100 18.4.4 bt mode transfer flow figure 18.6 shows the write transfer flow and fi gure 18.7 shows the read transfer flow in bt mode. wait for b_busy = 0 wait for h2b_atn = 0 host confirms the b_busy bit in btcr. host confirms the h2b_atn bit in btcr. host clears write pointer by setting the clr_wr_ptr bit in btcr. host writes data of 1 to n bytes to the btdtr buffer. confirms host write is started. the hbtwi bit in btsr0 is set. host sets the h2b_atn bit in btcr to indicate data write completion to the buffer for the bt interface. clear write pointer b_busy = 1 generate slave interrupt generate slave interrupt generate slave interrupt slave waits for the h2b_atn bit (interrupt from host) is set. slave reads data from the btdtr buffer. slave clears the h2b_atn bit in btcr. confirms the clr_wr_ptr bit. the crwpi bit in btsr1 is set to notify write pointer clearing as an interrupt to slave. confirms the h2b_atn bit is set. the h2bi bit in btsr1 is set. slave sets the b_busy bit in btcr. write btdtr buffer read btdtr buffer h2b_atn = 1 h2b_atn = 0 b_busy = 0 slave clears the b_busy bit in btcr to indicate transfer completion. host slave figure 18.6 bt wr ite transfer flow
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 603 of 862 rej09b0429-0100 wait for h_busy = 0 slave confirms the h_busy bit in btcr. host confirms the b2h_atn bit in btcr. the slave data write completion interrupt is notified to host. host sets the h_busy bit in btcr. slave writes data of 1 to n bytes to the btdtr buffer. slave sets the b2h_atn bit in btcr to indicate data write completion to the btdtr buffer. the hbtri bit in btsr0 is set to notify host reads all data through the btdtr buffer. host clears read pointer by setting the clr_rd_ptr bit in btcr. h_busy = 1 generate slave interrupt generate host interrupt generate slave interrupt generate slave interrupt host waits for the b2h_atn bit (interrupt from slave) is set by slave. host clears the b2h_atn bit in btcr. host reads data from the btdtr buffer. confirms the clr_rd_ptr bit. the crrpi bit in btsr1 is set to notify read pointer clearing as an interrupt source to slave. confirms the b2h_atn bit. the b2hi bit in btsr1 is set to notify host data read completion as an interrupt source to slave. write btdtr buffer read btdtr buffer h_busy = 0 host clears the h_busy bit in btcr to indicate transfer completion. b2h_atn = 1 clear read pointer b2h_atn = 0 host slave figure 18.7 bt read transfer flow
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 604 of 862 rej09b0429-0100 18.4.5 gate a20 the gate a20 signal can mask address a20 to emul ate the address mode of the 8086* architecture cpu used in personal computers. normally, the gate a20 signal can be controlled by a firmware. the fast gate a20 function that realizes high-seed performance by hardware is enabled by setting the fga20e bit to 1 in hicr0. note: an intel microprocessor (1) regular gate a20 operation output of the gate a20 signal can be controlled by an h'd1 command and data. when the slave (this lsi) receives data, it normally reads idr1 in the interrupt handling ro utine activated by the ibfi1 interrupt. at this time, firmware copies bit 1 of data following an h'd1 command and outputs it on pin ga20. (2) fast gate a20 operation the internal state of pin ga20 is initialized to 1 since the initial value of the fga20e bit is 0. when the fga20e bit is set to 1, pin p81/ga20 functions as the output of the fast ga20 signal. the state of pin ga20 can be monitored by reading bit ga20 in hicr2. the initial output from this pin is 1, which is the initial value. afterward, the host can manipulate the output from this pin by sending commands and data. this function is only available via the idr1. the lpc decodes commands input from th e host. when an h'd1 host command is detected, bit 1 of the data following the host command is output from pin ga20. this operation does not depend on firmware or interrupts, and is faster than the regular processing using interrupts. table 18.6 shows the conditions that set and clear pin ga20. figure 18.8 shows the ga20 output flow. table 18.7 indicates the ga20 output signal values. table 18.6 ga20 setting/clearing timing pin name setting condition clearing condition ga20 when bit 1 of the data that follows an h'd1 host command is 1 when bit 1 of the data that follows an h'd1 host command is 0
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 605 of 862 rej09b0429-0100 start wait for next byte h'd1 command received? host write host write yes no data byte? no write bit 1 of data byte to the bit of ga20 in dr yes figure 18.8 ga20 output
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 606 of 862 rej09b0429-0100 table 18.7 fast gate a20 output signals c/ d 1 data/command internal cpu interrupt flag (ibf) ga20 (p81) remarks 1 h'd1 command 0 q 0 1 data * 1 0 1 1 h'ff command 0 q (1) turn-on sequence 1 h'd1 command 0 q 0 0 data * 2 0 0 1 h'ff command 0 q (0) turn-off sequence 1 h'd1 command 0 q 0 1 data * 1 0 1 1/0 command other than h'ff and h'd1 1 q (1) turn-on sequence (abbreviated form) 1 h'd1 command 0 q 0 0 data * 2 0 0 1/0 command other than h'ff and h'd1 1 q (0) turn-off sequence (abbreviated form) 1 h'd1 command 0 q 1 command other than h'd1 1 q cancelled sequence 1 h'd1 command 0 q 1 h'd1 command 0 q retriggered sequence 1 h'd1 command 0 q 0 any data 0 1/0 1 h'd1 command 0 q (1/0) consecutively executed sequences notes: 1. any data with bit 1 set to 1. 2. any data with bit 1 cleared to 0.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 607 of 862 rej09b0429-0100 18.4.6 lpc interface shutdown function (lpcpd) the lpc interface can be placed in the shut down state according to the state of the lpcpd pin. there are two kinds of lpc interface shutdown state: lpc hardware shutdown and lpc software shutdown. the lpc hardware shutdown state is controlled by the lpcpd pin, while the lpc software shutdown state is controlled by the sdwn b bit. in both states, the lpc interface enters the reset state by itself, and is no longer affected by external signals other than the lreset and lpcpd signals. placing the slave in sleep mode or software standby mode is effective in reducing current dissipation in the shutdown state. if software standby mode is set, some means must be provided for exiting software standby mode before clearing the shutdown state with the lpcpd signal. if the sdwne bit has been set to 1 beforehand, the lpc hardware shutdown state is entered at the same time as the lpcpd signal falls, and prior preparation is not possible. if the lpc software shutdown state is set by means of the sdwnb bit, on the other hand, the lpc software shutdown state cannot be cleared at the same time as the rising edge of the lpcpd signal. taking these points into consideration, the following operating procedure uses a combination of lpc software shutdown and lpc hardware shutdown. 1. clear the sdwne bit to 0. 2. set the errie bit to 1 and wait for an interrupt by the sdwn flag. 3. when an erri interrupt is generated by th e sdwn flag, check the lpc interface internal status flags and perform any necessary processing. 4. set the sdwnb bit to 1 to set lpc software standby mode. 5. set the sdwne bit to 1 and make a transition to lpc hardware standby mode. the sdwnb bit is cleared automatically. 6. check the state of the lpcpd signal to make sure that the lpcpd signal has not risen during steps 3 to 5. if the signal has risen, clear sd wne to 0 to return to the state in step 1. 7. if software standby mode has been set, exit software standby mode by some means independent of the lpc. 8. when a rising edge is detected in the lpcpd signal, the sdwne bit is automatically cleared to 0. if the slave has been placed in sleep mode, the mode is exited by means of lreset signal input, on completion of the lpc tran sfer cycle, or by some other means.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 608 of 862 rej09b0429-0100 table 18.8 shows the scope of the lpc interface pin shutdown. table 18.8 scope of lpc interface pin shutdown abbreviation port scope of shutdown i/o notes lad3 to lad0 pe3 to p30 o i/o hi-z lframe pe4 o input hi-z lreset pe5 x input lpc hardware reset function is active lclk pe6 o input hi-z serirq pe7 o i/o hi-z lsci pd0 ? i/o hi-z, only when lscie = 1 lsmi pd1 ? i/o hi-z, only when lsmie = 1 pme pd2 ? i/o hi-z, only when pmee = 1 ga20 pd3 ? i/o hi-z, only when fga20e = 1 clkrun pd4 o input hi-z lpcpd pd5 x input needed to clear shutdown state [legend] o: pin that is shutdown by the shutdown function ? : pin that is shutdown only when the lpc f unction is selected by register setting x: pin that is not shutdown in the lpc shutdown state, the lpc's internal stat e and some register bits are initialized. the order of priority of lpc shutdown and reset states is as follows. 1. system reset (reset by res pin input, or wdt0 overflow) all register bits, including bits lpc4e to lpc1e, are initialized. 2. lpc hardware reset (reset by lreset pin input) lrstb, sdwne, and sdwnb bits are cleared to 0. 3. lpc software reset (reset by lrstb) sdwne and sdwnb bits are cleared to 0. 4. lpc hardware shutdown sdwnb bit is cleared to 0. 5. lpc software shutdown the scope of the initialization in each mode is shown in table 18.9.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 609 of 862 rej09b0429-0100 table 18.9 scope of initializatio n in each lpc interface mode items initialized system reset lpc reset lpc shutdown lpc transfer cycle sequencer (internal state), lpcbsy and abrt flags initialized initialized initialized serirq transfer cycle sequencer (internal state), clkreq and irqbsy flags initialized initialized initialized lpc interface flags (ibf1, ibf2, ibf3a, ibf3b, mwmf, c/ d 1, c/ d 2, c/ d 3, obf1, obf2, obf3a, obf3b, swmf, dbu, smicflg, smicir0, btsr0, btsr1, btimsr, btfvsr0, btfvsr1), ga20 (internal state) initialized initialized retained host interrupt enable bits (irq1e1, irq12e1, smie2, irq6e2, irq9e2 to irq11e2, smie3b, smie3a, irq6e3, irq9e3 to irq11e3, selreq, iedir2 to iedir3), q/ c flag initialized initialized retained lrst flag initialized (0) can be set/cleared can be set/cleared sdwn flag initialized (0) initialized (0) can be set/cleared lrstb bit initialized (0) hr: 0 sr: 1 0 (can be set) sdwnb bit initialized (0) initialized (0) hs: 0 ss: 1 sdwne bit initialized (0) initialized (0) hs: 1 ss: 0 or 1 lpc interface operation control bits (lpc3e to lpc1e, fga20e, ladr1 to ladr3, ibfie1 to ibfie3, pmee, pmeb, lsmie, lsmib, lscie, lscib, twre, selstr3, selirq1, selsmi, selirq3 to selirq15, hicr4, hicr5, scifar, hisel, btcsr0, btcsr1) initialized retained retained lreset signal input input lpcpd signal input (port function input input lad3 to lad0, lframe , lclk, serirq, clkrun signals input hi-z pme , lsmi , lsci, ga20 signals (when function is selected) output hi-z pme , lsmi , lsci, ga20 signals (when function is not selected) port function port function note: system reset: reset by stby input, res input, or wdt overflow lpc reset: reset by lpc hardware reset (hr) or lpc software reset (sr) lpc shutdown: reset by lpc hardware shut down (hs) or lpc software shutdown (ss)
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 610 of 862 rej09b0429-0100 figure 18.9 shows the timing of the lpcpd and lreset signals. lpcpd lreset lad3 to lad0 lframe lclk at least 30 s at least 100 s at least 60 s figure 18.9 power-down state termination timing
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 611 of 862 rej09b0429-0100 18.4.7 lpc interface serialized interrupt operation (serirq) a host interrupt request can be issued from the lpc interface by means of the serirq pin. in a host interrupt request via the serirq pin, lclk cycles are counted from the start frame of the serialized interrupt transfer cycle generated by the host or a peripheral function, and a request signal is generated by the frame corresponding to that interrupt. the timing is shown in figure 18.10. irq1 irq1 host controller none none serirq drive source lclk start start frame irq0 frame irq1 frame irq2 frame sl or h hrtr st r st r s t irq15 host controller none none serirq driver lclk start stop iochck frame stop frame next cycle irq14 frame irq15 frame r st r st r st rt h i h = host control, sl = slave control, r = recovery, t = turnaround, s = sample h = host control, r = recovery, t = turnaround, s = sample, i = idle figure 18.10 serirq timing
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 612 of 862 rej09b0429-0100 the serialized interrupt transfer cycle frame configuration is as follows. two of the states comprising each frame are the recover state in whic h the serirq signal is returned to the 1-level at the end of the frame, and the turnaround state in which the serirq signal is not driven. the recover state must be driven by the host or slave that was drivin g the preceding state. table 18.10 serialized interrupt transfer cycle fram e configuration serial interrupt transfer cycle frame count contents drive source number of states notes 0 start slave host 6 in quiet mode only, slave drive possible in the first state, then next 3 states 0-driven by host 1 irq0 slave 3 drive impossible 2 irq1 slave 3 drive possible in lpc channel 1 and scif 3 smi slave 3 drive possible in lpc channels 2, 3, and scif 4 irq3 slave 3 drive possible in scif or by irq3e 5 irq4 slave 3 drive possible in scif or by irq4e 6 irq5 slave 3 drive possible in scif or by irq5e 7 irq6 slave 3 drive possible in lpc channels 2, 3, and scif 8 irq7 slave 3 drive possible in scif or by irq7e 9 irq8 slave 3 drive possible in scif or by irq8e 10 irq9 slave 3 drive possible in lpc channels 2, 3, and scif 11 irq10 slave 3 drive possible in lpc channels 2, 3, and scif 12 irq11 slave 3 drive possible in lpc channels 2, 3, and scif 13 irq12 slave 3 drive possible in lpc channel 1 and scif 14 irq13 slave 3 drive possible in scif or by irq13e 15 irq14 slave 3 drive possible in scif or by irq14e 16 irq15 slave 3 drive possible in scif or by irq15e 17 iochck slave 3 drive impossible 18 stop host undefined first, 1 or more idle states, then 2 or 3 states 0-driven by host 2 states: quiet mode next 3 states: continuous mode next
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 613 of 862 rej09b0429-0100 there are two modes ? continuous mode and quiet mode ? for serialized inte rrupts. the mode initiated in the next transfer cycle is selected by the stop frame of the serialized interrupt transfer cycle that ended before that cycle. in continuous mode, the host initiates host interrupt transfer cycles at regular intervals. in quiet mode, the slave with interrupt sour ces requiring a request can also initiate an interrupt transfer cycle, in addition to the host. in quiet mode, since the host does not necessarily initiate interrupt transfer cycles, it is possible to suspend the clock (lclk) supply and enter the power-down state. in order for a slave to transfer an interrupt request in this case, a request to restart the clock must first be issued to the host. 18.4.8 lpc interface clock start request a request to restart the clock (lclk) can be sent to the host by means of the clkrun pin. with lpc data transfer and serirq in continuous mode, a clock restart is never requested since the transfer cycles are initiated by the host. with serirq in quiet mode, when a host interrupt request is generated the clkrun signal is driven and a clock (lclk) restart request is sent to the host. the timing for this operation is shown in figure 18.11. clk clkrun pull-up enable driven by the host processor driven by the slave processor 1 2 3 4 5 6 figure 18.11 clock start request timing cases other than serirq in quiet mode when clock restart is required must be handled with a different protocol, using the pme signal, etc. 18.4.9 scif control from lpc interface setting the scife bit in hicr5 to 1 allows the lpc host to communicate with the scif. then, the lpc interface can access the registers of the module scif other than scifcr. for details on transmission and reception, s ee section 15, serial communica tion interface with fifo (scif).
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 614 of 862 rej09b0429-0100 18.5 interrupt sources 18.5.1 ibfi1, ibfi2, ibfi3, and erri the host has four interrupt requests for the slav e (this lsi): ibf1, ibf2, ibf3, and erri. ibfi1, ibfi2, and ibfi3 are idr receive complete interrupts for idr1, idr2, and idr3 and twr, respectively. ibfi3 is also used for smic mode and bt mode interrupt requests. the erri interrupt indicates the occurrence of a special state such as an lpc reset, lpc shutdown, or transfer cycle abort. the lmci and lmcui interr upts are command receive complete interrupts. table 18.11 receive complete interrupts and error interrupt interrupt description ibfi1 when ibfie1 is set to 1 and idr1 reception is completed ibfi2 when ibfie2 is set to 1 and idr2 reception is completed ibfi3 when ibfie3 is set to 1 and idr3 reception is completed, or when twre and ibfie3 are set to 1 and reception is completed up to twr15 erri when errie is set to 1 and one of lrst, sdwn and abrt is set to 1
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 615 of 862 rej09b0429-0100 18.5.2 smi, hirq1, hirq3, hirq4, hi rq5, hirq6, hirq7, hirq8, hirq9, hirq10, hirq11, hirq12, hirq13, hirq14, and hirq15 the lpc interface can request 15 kinds of hos t interrupt by means of serirq. hirq1 and hirq12 are used on lpc channel 1, while smi, hirq6, hirq9, hirq10, and hirq11 can be requested from lpc channels 2 and 3. for the scif, any one of 15 types of interrupts can be selected. in addition, by the setting of scifcr4, the scif can request eight types of host interrupts: hirq3, hirq4, hirq5, hirq7, hirq8, hirq13, hirq14, and hirq15. there are two ways of clearing a host interrupt request when the lpc channels are used. when the iedir bit in sirqcr0is cleared to 0, host interrupt so urces and lpc channels are all linked to the host interrupt request enable bits. when the obf flag is cleared to 0 by a read of odr or twr15 by the host in the corresponding lpc channel, the corresponding host interrupt enable bit is automatically cleared to 0, and the host interrupt request is cleared. when the iedir bit is set to 1 in sirqcr, a host interrupt is only requested by the host interrupt enable bits. the host interrupt enable bit is not cleared when obf is cleared. therefore, smie2, smie3a, smie3b, smie4 and irq6en, irq9en, irq10en, irq11en lose their respective functional differences (n = 2, 3). in order to clear a host interrupt request, it is necessary to clear the host interrupt enable bit. as for hirq3 to hirq5, hirq7, hirq8, and hirq13 to hirq15, setting the enable bit in sirqcr4 to 1 requests the corresponding host interrupt, and clearing the enable bit to 0 clears the corresponding host interrupt request. when the scif channels are used, a host interr upt request is cleared when the relevant scif interrupt is cleared. table 18.12 summarizes the methods of setting and clearing these bits when the lpc channels are used, and table 18.13 summarizes the methods of setting and clearing these bits when the scif channels are used. figure 18.12 shows the processing flowchart.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 616 of 862 rej09b0429-0100 table 18.12 hirq setting and clearing conditions when lpc channels are used host interrupt setting condition clearing condition hirq1 internal cpu writes to odr1, then reads 0 from bit irq1e1 and writes 1 internal cpu writes 0 to bit irq1e1, or host reads odr1 hirq12 internal cpu writes to odr1, then reads 0 from bit irq12e1 and writes 1 internal cpu writes 0 to bit irq12e1, or host reads odr1 smi (iedir2 = 0 or iedir3 = 0) internal cpu ? writes to odr2, then reads 0 from bit smie2 and writes 1 ? writes to odr3, then reads 0 from bit smie3a and writes 1 ? writes to twr15, then reads 0 from bit smie3b and writes 1 internal cpu ? writes 0 to bit smie2, or host reads odr2 ? writes 0 to bit smie3a, or host reads odr3 ? writes 0 to bit smie3b, or host reads twr15 smi (iedir2 = 1 or iedir3 = 1) internal cpu ? reads 0 from bit smie2, then writes 1 ? reads 0 from bit smie3a, then writes 1 ? reads 0 from bit smie3b, then writes 1 internal cpu ? writes 0 to bit smie2 ? writes 0 to bit smie3a ? writes 0 to bit smie3b hirqi (i = 6, 9, 10, 11) (iedir2 = 0 or iedir3 = 0) internal cpu ? writes to odr2, then reads 0 from bit irqie2 and writes 1 ? writes to odr3, then reads 0 from bit irqie3 and writes 1 internal cpu ? writes 0 to bit irqie2, or host reads odr2 ? writes 0 to bit irqie3, or host reads odr3 hirqi (i = 6, 9, 10, 11) (iedir2 = 1 or iedir3 = 1) internal cpu ? reads 0 from bit irqie2, then writes 1 ? reads 0 from bit irqie3, then writes 1 internal cpu ? writes 0 to bit irqie2 ? writes 0 to bit irqie3
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 617 of 862 rej09b0429-0100 table 18.13 hirq setting and clearing co nditions when scif channels are used host interrupt setting condition clearing condition smi hirqi (i = 1, 3 to 15) the scif interrupt corresponding to the host interrupt request selected by sirqcr3 occurs. relevant scif interrupt is cleared slave cpu master cpu odr1 write write 1 to irq1e1 obf1 = 0? yes no no yes all bytes transferred? serirq irq1 output serirq irq1 source clear interrupt initiation odr1 read hardware operation software operation figure 18.12 hirq flowchart (example of channel 1)
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 618 of 862 rej09b0429-0100 18.6 usage note 18.6.1 data conflict the lpc interface provides buffering of asynch ronous data from the host and slave (this lsi), but an interface protocol that uses the flags in str must be followe d to avoid data conflict. for example, if the host and slave bo th try to access idr or odr at th e same time, the data will be corrupted. to prevent si multaneous accesses, ibf and obf must be used to allow access only to data for which writing has finished. unlike the idr and odr registers, the transfer direction is not fixed for the bidirectional data registers (twr). mwmf and swmf are provided in str to handle this situation. after writing to twr0, mwmf and swmf must be used to co nfirm that the write authority for twr1 to twr15 has been obtained. table 18.14 shows host address examples for ladr3 and registers, idr3, odr3, str3, twr0mw, twr0sw, and twr1 to twr15.
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 619 of 862 rej09b0429-0100 table 18.14 host address example register host address when ladr3 = h' a24f host address when ladr3 = h'3fd0 idr3 h'a24a and h'a24e h'3fd0 and h'3fd4 odr3 h'a24a h'3fd0 str3 h'a24e h'3fd4 twr0mw h'a250 h'3fc0 twr0sw h'a250 h'3fc0 twr1 h'a251 h'3fc1 twr2 h'a252 h'3fc2 twr3 h'a253 h'3fc3 twr4 h'a254 h'3fc4 twr5 h'a255 h'3fc5 twr6 h'a256 h'3fc6 twr7 h'a257 h'3fc7 twr8 h'a258 h'3fc8 twr9 h'a259 h'3fc9 twr10 h'a25a h'3fca twr11 h'a25b h'3fcb twr12 h'a25c h'3fcc twr13 h'a25d h'3fcd twr14 h'a25e h'3fce twr15 h'a25f h'3fcf
section 18 lpc interface (lpc) rev. 1.00 mar. 17, 2008 page 620 of 862 rej09b0429-0100
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 621 of 862 rej09b0429-0100 section 19 a/d converter this lsi includes a successive-approximation-type 10-bit a/d converter that allows up to eight analog input channels to be selected. a block diagram of the a/d converter is shown in figure 19.1. 19.1 features ? 10-bit resolution ? eight input channels ? conversion time: 4.7 s per channel (at 34-mhz operation) ? two operating modes single mode: single-channel a/d conversion scan mode: continuous a/d conversion on 1 to 4 channels or continuous a/d conversion on 1 to 8 channels ? eight data registers conversion results are held in a 16-bit data register for each channel ? sample and hold function ? three ways of starting a/d conversion ? software ? trigger from tmr_0 ? external trigger signal ? interrupt request a/d conversion end interrupt (adi) request can be generated ? module stop mode can be set
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 622 of 862 rej09b0429-0100 module data bus control circuit internal data bus 10-bit d/a comparator + sample-and-hold circuit adi interrupt signal conversion start trigger from tmr_0 a d c s r a d c r a d d r d a d d r c a d d r b a d d r a a d d r h a d d r g a d d r f a d d r e successive approximations register [legend] adcr: a/d control register adcsr: a/d control/status register addra: a/d data register a addrb: a/d data register b addrc: a/d data register c addrd: a/d data register d addre: a/d data register e addrf: a/d data register f addrg: a/d data register g addrh: a/d data register h avcc an0 an1 an2 an3 an4 an5 an6 an7 adtrg avref multiplexer bus interface avss figure 19.1 block diag ram of the a/d converter
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 623 of 862 rej09b0429-0100 19.2 input/output pins table 19.1 summarizes the pins used by the a/d converter. table 19.1 pin configuration pin name symbol i/o function analog input pin 0 an0 input analog input pin 1 an1 input analog input pin 2 an2 input analog input pin 3 an3 input analog input pin 4 an4 input analog input pin 5 an5 input analog input pin 6 an6 input analog input pin 7 an7 input analog input pins a/d external trigger input pin adtrg input external trigger input for starting a/d conversion analog power supply pin avcc input analog block power supply analog ground pin avss input analog block ground reference power supply pin avref input reference voltage for a/d converter
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 624 of 862 rej09b0429-0100 19.3 register descriptions the a/d converter has the following registers. ? a/d data register a (addra) ? a/d data register b (addrb) ? a/d data register c (addrc) ? a/d data register d (addrd) ? a/d data register e (addre) ? a/d data register f (addrf) ? a/d data register g (addrg) ? a/d data register h (addrh) ? a/d control/status register (adcsr) ? a/d control register (adcr) 19.3.1 a/d data registers a to h (addra to addrh) the addr are eight 16-bit read-only registers, addra to addrh, which store the results of a/d conversion. the addr registers, which store a conversion result for each channel, are shown in table 19.2. the converted 10-bit data is stored to bits 15 to 6. the lower 6-bit data is always read as 0. the data bus between the cpu an d the a/d converter is 16-bit wi dth and can be read directly from the cpu. the addr must always be accesse d in 16-bit unit. they cannot be accessed in 8- bit unit. the results of a/d conversion are stored in each registers, when the adf flag is set to 1.
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 625 of 862 rej09b0429-0100 table 19.2 analog input channels and corresponding addr registers analog input channel a/d data register to store a/d conversion results an0 addra an1 addrb an2 addrc an3 addrd an4 addre an5 addrf an6 addrg an7 addrh 19.3.2 a/d control/status register (adcsr) the adcsr controls the operation of the a/d conversion. bit bit name initial value r/w description 7 adf 0 r/(w) * a/d end flag a status flag that indicates the end of a/d conversion. this flag indicates that the results of a/d conversion are stored in the a/d data registers. [setting conditions] ? when a/d conversion ends in single mode ? when a/d conversion ends on all channels specified in scan mode [clearing conditions] ? when 0 is written after reading adf = 1 ? when dtc starts by an adi interrupt and addr is read 6 adie 0 r/w a/d interrupt enable enables adi interrupt by adf when this bit is set to 1
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 626 of 862 rej09b0429-0100 bit bit name initial value r/w description 5 adst 0 r/w a/d start clearing this bit to 0 stops a/d conversion and enters the idle state. setting this bit to 1 starts a/d conversion. in single mode, this bit is cleared to 0 automatically when conversion on the specified channel ends. in scan mode, conversion continues sequentially on the spec ified channels until this bit is cleared to 0 by software, a reset, or a transition to the hardware standby mode. 4 ? 0 r reserved this is a read-only bit and cannot be modified. 3 ? 0 r/w reserved the initial value should not be changed. channel select 2 to 0 select analog input channels together with the scane bit and the scans bit of adcr. 2 1 0 ch2 ch1 ch0 all 0 r/w when scane = 0, and scans = x 000: an0 001: an1 010: an2 011: an3 100: an4 101: an5 110: an6 111: an7 when scane = 1 and scans = 0 000: an0 001: an0 and an1 010: an0 to an2 011: an0 to an3 100: an4 101: an4 and an5 110: an4 to an6 111: an4 to an7 when scane = 1 and scans = 1 000: an0 001: an1 and an1 010: an0 to an2 011: an0 to an3 100: an0 to an4 101: an0 to an5 110: an0 to an6 111: an0 to an7 note: * only 0 can be written to clear the flag. [legend] x: don't care
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 627 of 862 rej09b0429-0100 19.3.3 a/d control register (adcr) the adcr sets the operation mode of a/d converter and the conversion time. bit bit name initial value r/w description 7 6 0 trgs1 trgs0 extrgs 0 0 0 r/w r/w r/w timer trigger select 1 and 0, extended trigger select enable starting of a/d conversion by a trigger signal. these bits should be set while a/d conversion is stopped (adsf = 0). 00 0: disables starting by trigger signals. 10 0: enables starting by a trigger from tmr_0. 10 1: enables starting by the adtrg pin input. other than above: setting prohibited 5 4 scane scans 0 0 r/w r/w scan mode select the operation mode of a/d conversion 0x: single mode 10: scan mode (consecutive a/d conversion of channels 1 to 4) 11: scan mode (consecutive a/d conversion of channels 1 to 8) 3 2 cks1 cks0 0 0 r/w r/w clock select 1 and 0 set the a/d conversion time. setting should be made while the conversion is stopped (adst = 0). 00: setting prohibited 01: conversion time = 80 states (max) (20 mhz or less) 10: conversion time = 160 states (max) 11: conversion time = 320 states (max) 1 adstclr 0 r/w a/d start clear sets automatic clearing of the adst bit in scan mode. 0: disables automatic clearing of adst in scan mode. 1: adst is automatically cl eared when a/d conversion for all the selected channels has been completed in scan mode. [legend] x: don't care
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 628 of 862 rej09b0429-0100 19.4 operation the a/d converter operates by successive appr oximation with 10-bit resolution. it has two operating modes: single mode and scan mode. when changing the operating mode or analog input channel, to prevent incorrect operation, first cl ear the adst bit to 0 in adcsr to halt a/d conversion. the adst bit can be set to 1 at the same time as the operating mode or analog input channel is changed. 19.4.1 single mode in single mode, a/d conversion is performed only once on the specified single channel. operations are as follows. 1. a/d conversion on the specified channel is started when the adst bit in adcsr is set to 1, by software or by the input of trigger signal. 2. when a/d conversion is completed, the resu lt is transferred to the a/d data register corresponding to the channel. 3. on completion of a/d conversion, the adf bit in adcsr is set to 1. if the adie bit is set to 1 at this time, an adi interrupt request is generated. 4. the adst bit remains set to 1 during a/d conversion. when conversion ends, the adst bit is automatically cleared to 0, and the a/d convert er enters the idle state. if the adst bit is cleared during a/d conversion, the a/d converte r stops conversion and enters the idle state.
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 629 of 862 rej09b0429-0100 adie adst adf set * set * set * a/d conversion starts clear * clear * state of channel 0 (an0) state of channel 1 (an1) state of channel 2 (an2) state of channel 3 (an3) idle idle idle idle idle idle a/d conversion 1 a/d conversion 2 read the result of conversion result of a/d conversion 1 result of a/d conversion 2 read the result of conversion note : * indicates execution of a software instruction. addra addrb addrc addrd figure 19.2 example of a/d converter operation (when channel 1 is selected in single mode) 19.4.2 scan mode in scan mode, a/d conversion is performed sequenti ally on the specified channels (four channels or eight channel maximum). operations are as follows. 1. when the adst bit in adcsr is set to 1 by software or by the input of trigger signal, a/d conversion starts from the firs t channel of the selected channe l. consecutive a/d conversion of either four channels maximum (scane and scans = b'10) or eight channels maximum (scane and scans = b'11) can be selected. in the case of consecutive a/d conversion on four channels, the operation starts from an0 when ch2 = b'0, and starts from an4 when ch2 = b'1. in the case of consecutive a/d conversion on eight channels, the operation starts from an0. 2. when a/d conversion for each channel is comple ted, the result is sequentially transferred to the a/d data register corresponding to each channel. 3. when conversion of all the selected channels is completed, the adf bit in adcsr is set to 1. if the adie bit is set to 1 at this time, an adi interrupt is requested after a/d conversion ends. conversion of the first channe l in the group starts again.
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 630 of 862 rej09b0429-0100 4. the adst bit is not automatica lly cleared to 0 and steps 2 to 3 are repeated as long as the adst bit remains set to 1. when the adst bit is cleared to 0, a/d conversion stops and the a/d converter enters the idle state. after that , when the adst bit is set to 1, the operation starts from the first channel again. adst adf addra addrb addrc addrd * 2 set * 1 clear * 1 clear * 1 state of channel 0 (an0) state of channel 1 (an1) state of channel 2 (an2) state of channel 3 (an3) idle idle idle idle idle continuous execution of a/d conversion idle idle idle idle transfer a/d conversion 1 a/d conversion 2 a/d conversion 3 a/d conversion 4 a/d conversion time result of a/d conversion 1 result of a/d conversion 4 result of a/d conversion 2 result of a/d conversion 3 1. indicates execution of a software instruction. 2. the data being converted is ignored notes : a/d conversion 5 figure 19.3 example of a/d converter operation (when channels an0 to an3 are selected in scan mode)
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 631 of 862 rej09b0429-0100 19.4.3 input sampling and a/d conversion time the a/d converter has a built-in sample-and-hold circuit. the a/d converter samples the analog input when the a/d conversion start delay time (t d ) has passed after the adst bit in adcsr is set to 1, then starts a/d conversion. figure 19.4 shows the a/d conversion timing. tables 19.3 and 19.4 show the a/d conversion time. as indicated in figure 19.4, the a/d conversion time (t conv ) includes t d and the input sampling time (t spl ). the length of t d varies depending on the timing of the write access to adcsr. the total conversion time therefore varies with in the ranges indicated in table 19.3. in scan mode, the values given in table 19.3 apply to the first conversion time. the values given in table 19.4 apply to the second and subsequent conversions. in either case, bits cks1 and cks0 in adcr should be set so that the conversion time is within the ranges indicated by the a/d conversion characteristics.
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 632 of 862 rej09b0429-0100 address write signal input sampling timing adf [legend] (1): adcsr write cycle (2): adcsr address t d : a/d conversion start delay t spl : input sampling time t conv : a/d conversion time (2) (1) t d t spl t conv figure 19.4 a/d conversion timing
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 633 of 862 rej09b0429-0100 table 19.3 a/d conversion ch aracteristics (single mode) cks1 = 0 cks1 = 1 cks0 = 1 cks0 = 0 cks0 = 1 item symbol min. typ. max. min. typ. max. min. typ. max. a/d conversion start delay time t d (6) ? (9) (10) ? (17) (18) ? (33) input sampling time t spl ? 30 ? ? 60 ? ? 120 ? a/d conversion time t conv 77 ? 80 153 ? 160 305 ? 320 note: values in the table are the number of states. table 19.4 a/d conversion ch aracteristics (scan mode) cks1 cks0 conversion time (number of states) 0 setting prohibited 0 1 80 (fixed) 0 160 (fixed) 1 1 320 (fixed)
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 634 of 862 rej09b0429-0100 19.4.4 timing of external trigger input a/d conversion can also be started by an externally input trigger signal. setting the trgs1 and trgs0 bits in adcr to b'11 selects the signal on the adtrg pin as an external trigger. the adst bit in adcsr is set to 1 on the falling edge of adtrg , initiating a/d conversion. other operations are the same as those in the case where th e adst bit is set to 1 by software, regardless of whether the converter is in single mode or scan mode. the timing of this operation is shown in figure 19.5. adtrg adst a/d conversion time internal trigger signal figure 19.5 timing of external trigger input
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 635 of 862 rej09b0429-0100 19.5 interrupt source the a/d converter generates an a/d conversion end interrupt (adi) at the end of a/d conversion. setting the adie bit to 1 enables adi interrupt requests while the adf bit in adcsr is set to 1 after a/d conversion ends. the adi interrupt can be used to activate the dtc. reading the converted data by the dtc activat ed by the adi interrupt allows consecutive conversion to be performed without software overhead. table 19.5 a/d converter interrupt source name interrupt source interrupt flag dtc activation adi a/d conversion end adf possible 19.6 a/d conversion accuracy definitions this lsi?s a/d conversion accuracy definitions are given below. ? resolution the number of a/d converter digital output codes ? quantization error the deviation inherent in the a/d converter, given by 1/2 lsb (see figure19.6). ? offset error the deviation of the analog input voltage valu e from the ideal a/d conversion characteristic when the digital output changes from the minimum voltage value b'00 0000 0000 (h'000) to b'00 0000 0001 (h'001) (see figure 19.7). ? full-scale error the deviation of the analog input voltage valu e from the ideal a/d conversion characteristic when the digital output changes from b'11 1111 1110 (h'3fe) to b'11 1111 1111 (h'3ff) (see figure 19.7). ? nonlinearity error the error with respect to the ideal a/d conversio n characteristics between the zero voltage and the full-scale voltage. does not in clude the offset error, full-scal e error, or qu antization error (see figure 19.7). ? absolute accuracy the deviation between the digital value and the analog input value. includes the offset error, full-scale error, quantization error, and nonlinearity error.
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 636 of 862 rej09b0429-0100 h'3ff h'3fe h'3fd h' 004 h'003 h'002 h'001 h'000 1 1024 2 1024 1022 1024 1023 1024 fs quantization error digital output ideal a/d conversion characteristic analog input voltage figure 19.6 a/d conversion accuracy definitions fs offset error nonlinearity error actual a/d conversion characteristic analog input voltage digital output ideal a/d conversion characteristic full-scale error figure 19.7 a/d conversion accuracy definitions
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 637 of 862 rej09b0429-0100 19.7 usage notes 19.7.1 setting of module stop mode operation of the a/d converter can be enabled or disabled by setting the module stop control register. by default, the a/d converter is stopped. registers of the a/d converter only become accessible when it is released from module stop mode. see sect ion 24, power-do wn modes, for details. 19.7.2 permissible si gnal source impedance this lsi?s analog input is designed so that the conversion accuracy is guaranteed for an input signal for which the signal source impedance is 5 k ? or less. this specification is provided to enable the a/d converter?s sample -and-hold circuit input capacitance to be charged within the sampling time; if the sensor output impedance exceeds 5 k ? , charging may be insufficient and it may not be possible to guarantee the a/d convers ion accuracy. however, if a large capacitance is provided externally in single mode, the input load will essentially comprise only the internal input resistance of 10 k ? , and the signal source impedance is ignored. however, since a low-pass filter effect is obtained in this case, it may not be possible to follow an analog signal with a large differential coefficient (voltage fluctuation ratio of 5 mv/s or greater for example) (see figure 19.8). when converting a high-speed analog signal or converting in scan mode, a low-impedance buffer should be inserted. a/d converter equivalent circuit this lsi 20 pf c in = 15 pf 10 k ? up to 5 k ? low-pass filter c up to 0.1 f sensor output impedance sensor input figure 19.8 example of analog input circuit
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 638 of 862 rej09b0429-0100 19.7.3 influences on absolute accuracy adding capacitance results in coupling with gnd, and therefor e noise in gnd may adversely affect the absolute accuracy. be sure to make the connection to an electrical ly stable gnd such as avss. care is also required to insure that filter circuits do not communicate with digital signals on the mounting board, so acting as antennas. 19.7.4 setting range of analog power supply and other pins if conditions shown below are not met, the reliab ility of this lsi may be adversely affected. ? analog input voltage range the voltage applied to analog input pin ann during a/d conversion should be in the range avss v an avref. ? relation between avcc, avss and vcc, vss the relationship between avcc, avss an d vcc, vss should be avcc = vcc 0.3v and avss = vss. when the a/d converter is not used, set avcc = vcc and avss = vss. ? avref pin reference volta ge specification range the reference voltage of the avref pin should be in the range avref avcc. 19.7.5 notes on board design in board design, digital circuitry and analog circuitry should be as mutually isolated as possible, and layout in which digital circuit signal lines and analog circuit signal lines cross or are in close proximity should be avoided as far as possible. failure to do so may result in incorrect operation of the analog circuitry due to in ductance, adversely affecting a/d conversion values. also, digital circuitry must be isolated from the analog inpu t signals (an0 to an7) , the analog reference voltage (avref) and analog power supply (avcc) by the analog ground (avss). also, the analog ground (avss) should be connected at one point to a stable digital ground (vss) on the board.
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 639 of 862 rej09b0429-0100 19.7.6 notes on no ise countermeasures in order to prevent damage due to an abnormal vo ltage such as an excessi ve surge at the analog input pins (an0 to an7), a protection circuit should be connected between avcc and avss as shown in figure 19.9. also, the bypass capacitors connected to avcc and the filter capacitors connected to an0 to an7 must be connected to avss. when a filter capacitor is connected, the input currents at the analog input pins (an0 to an7) are averaged which may cause an error. also, when a/d conversion is performed frequently, as in scan mode, if the current charged and discharged by the capacitance of the sample-and-hold circuit in the a/d converter excee ds the current input via the input impedance (r in ), an error will arise in the analog input pin voltage. therefore, careful cons ideration is required upon deciding the circuit constants. avcc * 1 an0 to an7 avss notes: values are reference values. * 1 * 2 r in : input impedance * 1 r in * 2 100 ? 0.1 f 0.01 f 10 f avref figure 19.9 example of analog input protection circuit
section 19 a/d converter rev. 1.00 mar. 17, 2008 page 640 of 862 rej09b0429-0100 table 19.6 standard of analog pins item min. max. unit analog input capacitance ? 20 pf acceptable signal source impedance ? 5 k ? 20 pf to a/d converter an0 to an7 10 k ? note: values are reference values. figure 19.10 analog input pin equivalent circuit 19.7.7 note on the usage in software standby mode if this lsi enters software standby mode with th e a/d conversion enabled, the content of the a/d converter is retained and about the same amount of analog supply current may flow as that flows when a/d conversion in progress. if the analog supply current must be reduced in software standby mode, clear th e adst bit to disable the a/d conversion.
section 20 ram rev. 1.00 mar. 17, 2008 page 641 of 862 rej09b0429-0100 section 20 ram this lsi has 40 kbytes of on-chip high-speed st atic ram. the ram is connected to the cpu by a 16-bit data bus, enabling one-state access by the cpu to both byte data and word data. the on-chip ram can be enabled or disabled by means of the rame bit in the system control register (syscr). for details on syscr, see s ection 3.2.2, system control register (syscr).
section 20 ram rev. 1.00 mar. 17, 2008 page 642 of 862 rej09b0429-0100
section 21 flash memory rev. 1.00 mar. 17, 2008 page 643 of 862 rej09b0429-0100 section 21 flash memory the flash memory has the follow ing features. figure 21.1 shows a block diagram of the flash memory. 21.1 features ? size 512 kbytes (rom address: h'000000 to h'07ffff) ? programming/erasing interface by the download of on-chip program this lsi has a dedicated programming/erasing program. after downloading this program to the on-chip ram, programming/erasing can be performed by setting the argument parameter. ? programming/erasing time the flash memory programming time is 1 ms (typ) in 128-byte simultaneous programming and approximately 7.8 s per byte. the erasing time is 600 ms (typ) per 64-kbyte block. ? number of programming the number of flash memory programming can be up to 100 times at the minimum. (the value ranged from 1 to 100 is guaranteed.) ? three on-board programming modes ? boot mode this mode is a program mode that uses an on-chip sci inte rface. the user mat and user boot mat can be programmed. this mode can automatically adjust the bit rate between host and this lsi. ? user program mode the user mat can be programmed by using the optional interface. ? user boot mode the user boot program of the optional inte rface can be made and the user mat can be programmed. ? programming/erasing protection sets protection against flash memory programming/erasing via hardware, software, or error protection. ? programmer mode this mode uses the prom programmer. the user mat and user boot mat can be programmed.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 644 of 862 rej09b0429-0100 fccs fpcs fecs fkey fmats control unit memory mat unit flash memory user mat: 512 kbytes user boot mat: 16 kbytes operating mode module bus fwe pin mode pin internal address bus internal data bus (16 bits) [legend] fccs: flash code control status register fpcs: flash program code select register fecs: flash erase code select register fkey: flash key code register fmats: flash mat select register ftdar: flash transfer destination address register to read from or write to the registers, the flshe bit in the serial timer control register (stcr) must be set to 1. note: ftdar figure 21.1 block diagram of flash memory
section 21 flash memory rev. 1.00 mar. 17, 2008 page 645 of 862 rej09b0429-0100 21.1.1 operating mode when each mode pin and the fwe pin are set in the reset state and reset start is performed, this lsi enters each operating mode as shown in figure 21.2. ? flash memory can be read in user mode, but cannot be programmed or erased. ? flash memory can be read, programmed, or eras ed on the board only in boot mode, user program mode, and user boot mode. ? flash memory can be read, programmed, or er ased by means of the prom programmer in programmer mode. reset state programmer mode user mode user program mode user boot mode boot mode on-board programming mode res = 0 res = 0 user mode sett ing user boot mode setting res = 0 boot mode setting res = 0 res = 0 programmer mode setting flshe = 0 fwe = 0 fwe = 1 flshe = 1 figure 21.2 mode transition of flash memory
section 21 flash memory rev. 1.00 mar. 17, 2008 page 646 of 862 rej09b0429-0100 21.1.2 mode comparison the comparison table of programming and erasing related items about boot mode, user program mode, user boot mode, and programmer mode is shown in table 21.1. table 21.1 comparison of programming modes boot mode user program mode user boot mode programmer mode programming/ erasing environment on-board on-board on-board prom programmer programming/ erasing enable mat user mat user boot mat user mat user mat user mat user boot mat all erasure (automatic) (automatic) block division erasure * 1 program data transfer from host via sci via optional device via optional device via programmer reset initiation mat embedded program storage mat user mat user boot mat * 2 ? transition to user mode changing mode setting and reset changing flshe bit and fwe pin changing mode setting and reset ? notes: 1. all-erasure is performed. afte r that, the specified block can be erased. 2. firstly, the reset vector is fetched fr om the embedded program storage mat. after the flash memory related registers are checked, the reset vector is fetched from the user boot mat. ? the user boot mat can be programmed or erased only in boot mode and programmer mode. ? the user mat and user boot mat are erased in boot mode. then, the user mat and user boot mat can be programmed by means of the command method. however, the contents of the mat cannot be read until this state. only user boot mat is programmed and the user mat is programmed in user boot mode or only user mat is progra mmed because user boot mode is not used. ? the boot operation of the optional interface can be performed by the mode pin setting different from user program mode in user boot mode.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 647 of 862 rej09b0429-0100 21.1.3 flash memory mat configuration this lsi?s flash memory is configured by the 16-kbyte user boot mat and 512-kbyte user mat. the start address is allocated to the same address in the user mat and user boot mat. therefore, when the program execution or data access is performed between two mats, the mat must be switched by using fmats. the user mat or user boot mat can be read in all modes. however, the user boot mat can be programmed only in boot mode and programmer mode. address h'000000 address h'07ffff address h'000000 address h'003fff 512 kbytes 16 kbytes figure 21.3 flash memory configuration the size of the user mat is different from that of the user boot mat. an address which exceeds the size of the 16-kbyte user bo ot mat should not be accessed. if the attempt is made, data is read as undefined value.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 648 of 862 rej09b0429-0100 21.1.4 block division the user mat is divided into seven 64-kbyte blocks, one 32-kbyte block, and eight 4-kbyte blocks as shown in figure 21.4. the user mat can be erased in this divided-block units, and the erase-block number of eb0 to eb15 is specified when erasing. programming is performed in 128- byte units starting at the addresses whose lowest-order byte is h?00 or h?80.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 649 of 862 rej09b0429-0100 eb0 erase unit: 4 kbytes eb1 erase unit: 4 kbytes eb2 erase unit: 4 kbytes eb3 erase unit: 4 kbytes eb4 erase unit: 4 kbytes eb5 erase unit: 4 kbytes eb6 erase unit: 4 kbytes eb7 erase unit: 4 kbytes eb12 erase unit: 64 kbytes eb13 erase unit: 64 kbytes h'000000 h'000001 h'000002 h'00007f h'000fff h'00107f h'00207f h'00307f h'00407f h'004fff h'00507f h'005fff h'001fff h'002fff h'003fff h'05ffff h'00607f h'006fff h'00707f h'007fff h'04f07f h'04ffff h'05007f programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes h'001000 h'001001 h'001002 h'002000 h'002001 h'002002 h'003000 h'003001 h'003002 h'004000 h'004001 h'004002 h'005000 h'005001 h'005002 h'006000 h'006001 h'006002 h'007000 h'007001 h'007002 h'040000 h'04f001 h'04f002 h'050000 h'050001 h'050002 h'000f80 h'000f81 h'000f82 h'001f80 h'001f81 h'001f82 h'002f80 h'002f81 h'002f82 h'003f80 h'003f81 h'003f82 h'004f80 h'004f81 h'004f82 h'04ff80 h'04ff81 h'04ff82 h'05ff80 h'05ff81 h'05ff82 h'005f80 h'005f81 h'005f82 h'006f80 h'006f81 h'006f82 h'007f80 h'007f81 h'007f82 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? eb14 erase unit: 64 kbytes eb15 erase unit: 64 kbytes eb8 erase unit: 32 kbytes eb9 erase unit: 64 kbytes eb10 erase unit: 64 kbytes eb11 erase unit: 64 kbytes h'07ffff h'06007f h'06ffff h'07007f programming unit: 128 bytes programming unit: 128 bytes h'060000 h'060001 h'060002 h'070000 h'070001 h'070002 h'06ff80 h'06ff81 h'06ff82 h'07ff80 h'07ff81 h'07ff82 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? h'01ffff h'00807f h'00ffff h'01007f programming unit: 128 bytes programming unit: 128 bytes h'008000 h'008001 h'008002 h'010000 h'010001 h'010002 h'00ff80 h'00ff81 h'00ff82 h'01ff80 h'01ff81 h'01ff82 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? h'03ffff h'02007f h'02ffff h'03007f programming unit: 128 bytes programming unit: 128 bytes h'020000 h'020001 h'020002 h'030000 h'030001 h'030002 h'02ff80 h'02ff81 h'02ff82 h'03ff80 h'03ff81 h'03ff82 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? figure 21.4 block division of user mat
section 21 flash memory rev. 1.00 mar. 17, 2008 page 650 of 862 rej09b0429-0100 21.1.5 programming/erasing interface programming/erasing is executed by downloading the on-chip program to the on-chip ram and specifying the program address/data and erase bl ock by using the interface register/parameter. the procedure program is made by the user in user program mode and user boot mode. an overview of the procedure is given as follows. for details, see section 21.4.2, user program mode. initialization execution (downloaded program execution) select on-chip program to be downloaded and specify the destination. start user procedure program for programming/erasing. end user procedure program yes programming (in 128-byte units) or erasing (in one-block units) (downloaded program execution) download on-chip program by setting fkey and sco bits. no programming/erasing completed? figure 21.5 overview of user procedure program 1. selection of on-chip program to be downloaded for programming/erasing execution, the flshe b it in stcr must be set to 1 to transition to user program mode. this lsi has programming/erasing programs which can be downloaded to the on-chip ram. the on-chip program to be downloaded is selected by setting the corresponding bits in the programming/erasing interface register. the address of the programming destination is specified by the flash transfer des tination address register (ftdar).
section 21 flash memory rev. 1.00 mar. 17, 2008 page 651 of 862 rej09b0429-0100 2. download of on-chip program the on-chip program is automatically downloaded by setting the flash key code register (fkey) and the sco bit in the flash code control status register (fccs), which are programming/erasing interface registers. the flash memory is replaced to the embedded program storage area when downloading. since the flash memory cannot be r ead when programming/erasing, the procedure program, which is working from download to completion of programming/erasing, must be executed in the space other than the flash memory to be programmed/erased (for example, on-chip ram). since the result of download is returned to the programming/erasing interface parameter, whether the normal download is executed or not can be confirmed. 3. initialization of programming/erasing the operating frequency is set before execution of programming/erasing. this setting is performed by using the programmi ng/erasing interface parameter. 4. programming/erasing execution for programming/erasing execution, the flshe b it in stcr and the fwe pin must be set to 1 to transition to user program mode. the program data/programming destination address is specified in 128-byte units when programming. the block to be erased is specified in erase-block units when erasing. these specifications are set by using the prog ramming/erasing interface parameter and the on- chip program is initiated. the on-chip progr am is executed by using the jsr or bsr instruction and performing the subroutine call of the specified address in the on-chip ram. the execution result is retu rned to the programming/era sing interface parameter. the area to be programmed must be erased in advance when programming flash memory. all interrupts are prohibited during programming and erasing. interrupts must be masked within the user system. 5. when programming/erasing is executed consecutively when the processing is not ended by the 128-byte programming or one-block erasure, the program address/data and erase-block number must be updated and consecutive programming/erasing is required. since the downloaded on-chip program is left in the on-chip ram after the processing, download and initialization are not required when the same processing is executed consecutively.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 652 of 862 rej09b0429-0100 21.2 input/output pins table 21.2 shows the flash memory pin configuration. table 21.2 pin configuration pin name input/output function res input reset fwe input flash memory programming/erasing enable pin md2 input sets operating mode of this lsi md1 input sets operating mode of this lsi md0 input sets operating mode of this lsi txd1 output serial transmit data output (used in boot mode) rxd1 input serial receive data input (used in boot mode) 21.3 register descriptions the registers/parameters which control flash memory are shown in the following. to read from or write to these registers/parameters, the flshe bit in the serial timer control register (stcr) must be set to 1. for details on stcr, see section 3.2.3, serial timer control register (stcr). ? flash code control status register (fccs) ? flash program code sel ect register (fpcs) ? flash erase code select register (fecs) ? flash key code register (fkey) ? flash mat select register (fmats) ? flash transfer destination address register (ftdar) ? download pass/fail result (dpfr) ? flash pass/fail result (fpfr) ? flash multipurpose address area (fmpar) ? flash multipurpose data destination area (fmpdr) ? flash erase block select (febs) ? flash programming/erasing frequency control (fpefeq) there are several operating modes for accessing fl ash memory, for example, read mode/program mode.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 653 of 862 rej09b0429-0100 there are two memory mats: user mat and user boot mat. the dedicated registers/parameters are allocated for each operating mode and mat se lection. the correspondence of operating modes and registers/parameters for use is shown in table 21.3. table 21.3 register/para meter and target mode download initiali- zation program- ming erasure read fccs ? ? ? ? fpcs ? ? ? ? fecs ? ? ? ? fkey ? ? fmats ? ? * 1 * 1 * 2 programming/ erasing interface register ftdar ? ? ? ? dpfr ? ? ? ? fpfr ? ? fpefeq ? ? ? ? fmpar ? ? ? ? fmpdr ? ? ? ? programming/ erasing interface parameter febs ? ? ? ? notes: 1. the setting is required when programmi ng or erasing user mat in user boot mode. 2. the setting may be required according to the combination of initiation mode and read target mat.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 654 of 862 rej09b0429-0100 21.3.1 programming/erasing interface register the programming/erasing interface re gisters are as described below. they are all 8-bit registers that can be accessed in byte. these registers are in itialized at a reset or in hardware standby mode. ? flash code control status register (fccs) fccs is configured by bits wh ich request the monitor of the fw e pin state and error occurrence during programming or erasing flash memory and the download of on-chip program. bit bit name initial value r/w description 7 fwe 1/0 r flash program enable monitors the signal level input to the fwe pin and enables or disables programming/erasing flash memory. 0: programming/erasing disabled 1: programming/erasing enabled 6, 5 ? all 0 r/w reserved the initial value should not be changed.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 655 of 862 rej09b0429-0100 bit bit name initial value r/w description 4 fler 0 r flash memory error indicates an error occurs during programming and erasing flash memory. when fler is set to 1, flash memory enters the error protection state. when fler is set to 1, high voltage is applied to the internal flash memory. to reduce the damage to flash memory, the reset must be released afte r the reset period of 100 s which is longer than normal. 0: flash memory operates normally. programming/erasing protection for flash memory (error protection) is invalid. [clearing condition] ? at a reset or in hardware standby mode 1: an error occurs during programming/erasing flash memory. programming/erasing protection for flash memory (error protection) is valid. [setting conditions] ? when an interrupt, such as nmi, occurs during programming/erasing flash memory. ? when the flash memory is read during programming/erasing flash memory (including a vector read or an instruction fetch). ? when the sleep instruction is executed during programming/erasing flash memory (including software-standby mode) ? when a bus master other than the cpu, such as the dtc, gets bus mastership during programming/erasing flash memory.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 656 of 862 rej09b0429-0100 bit bit name initial value r/w description 3 weinte 0 r/w program/erase enable modifies the space for the interrupt vector table, when interrupt vector data is not read successfully during programming/erasing flash memory or switching between a user mat and a user boot mat. when this bit is set to 1, interrupt vector data is read from address spaces h'ffe080 to h'ffe0ff (on-chip ram space), instead of from address spaces h'000000 to h'00007f (up to vector number 31). therefore, make sure to set the vector table in the on-chip ram space before setting this bit to 1. the interrupt exception handling on and after vector number 32 should not be used because the correct vector is not read, resulting in the cpu runaway. 0: the space for the interrupt vector table is not modified. when interrupt vector data is not read successfully, the operation for the interrupt exception handling cannot be guaranteed. an oc currence of any interrupts should be masked. 1: the space for the interrupt vector table is modified. even when interrupt vector data is not read successfully, the interrupt exception handling up to vector number 31 is enabled. 2, 1 ? all 0 r/w reserved the initial value should not be changed.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 657 of 862 rej09b0429-0100 bit bit name initial value r/w description 0 sco 0 (r)/w * source program copy operation requests the on-chip programming/erasing program to be downloaded to the on-chip ram. when this bit is set to 1, the on-chip program which is selected by fpcs/fecs is automatically downloaded in the on-chip ram specified by ftdar. in order to set this bit to 1, h a5 must be written to fkey and this operation must be executed in the on-chip ram. four nop instructions must be executed immediately after setting this bit to 1. since this bit is cleared to 0 when download is completed, this bit cannot be read as 1. all interrupts must be disabled. this should be made in the user system. 0: download of the on-chip programming/erasing program to the on-chip ram is not executed. [clearing condition] when download is completed 1: request that the on-chip programming/erasing program is downloaded to the on-chip ram is occurred. [setting conditions] when all of the following conditions are satisfied and 1 is set to this bit ? h'a5 is written to fkey ? during execution in the on-chip ram note: * this bit is a write only bit. this bit is always read as 0.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 658 of 862 rej09b0429-0100 ? flash program code select register (fpcs) fpcs selects the on-chip programming program to be downloaded. bit bit name initial value r/w description 7 to 1 ? all 0 r/w reserved the initial value should not be changed. 0 ppvs 0 r/w program pulse verify selects the programming program. 0: on-chip programming program is not selected. [clearing condition] when transfer is completed 1: on-chip programming program is selected. ? flash erase code select register (fecs) fecs selects download of the on-chip erasing program. bit bit name initial value r/w description 7 to 1 ? all 0 r/w reserved the initial value should not be changed. 0 epvb 0 r/w erase pulse verify block selects the erasing program. 0: on-chip erasing program is not selected. [clearing condition] when transfer is completed 1: on-chip erasing program is selected.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 659 of 862 rej09b0429-0100 ? flash key code register (fkey) fkey is a register for software protection that enables download of on-chip program and programming/erasing of flash memory. before setting the sco bit to 1 in order to download on- chip program or executing the downloaded programming/erasing program, these processing cannot be executed if the key code is not written. bit bit name initial value r/w description 7 6 5 4 3 2 1 0 k7 k6 k5 k4 k3 k2 k1 k0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w key code only when h'a5 is written, wr iting to the sco bit is valid. when the value other than h' a5 is written to fkey, 1 cannot be set to the sco bit. therefore downloading to the on-chip ram cannot be executed. only when h'5a is written, programming/erasing can be executed. even if the on-chip programming/erasing program is executed, the flash memory cannot be programmed or erased when t he value other than h'5a is written to fkey. h'a5: writing to the sco bit is enabled. (the sco bit cannot be set by the value other than h'a5.) h'5a: programming/erasing is enabled. (the value other than h'a5 is in softw are protection state.) h'00: initial value
section 21 flash memory rev. 1.00 mar. 17, 2008 page 660 of 862 rej09b0429-0100 ? flash mat select register (fmats) fmats specifies whether user mat or user boot mat is selected. bit bit name initial value r/w description 7 6 5 4 3 2 1 0 ms7 ms6 ms5 ms4 ms3 ms2 ms1 ms0 0/1 * 0 0/1 * 0 0/1 * 0 0/1 * 0 r/w r/w r/w r/w r/w r/w r/w r/w mat select these bits are in user-ma t selection state when the value other than h'aa is written and in user-boot-mat selection state when h'aa is written. the mat is switched by writ ing the value in fmats. when the mat is switched, follow section 21.6, switching between user mat and user boot mat. (the user boot mat cannot be programmed in user program mode if user boot mat is se lected by fmats. the user boot mat must be programmed in boot mode or in programmer mode.) h'aa: the user boot mat is selected (in user-mat selection state when the value of these bits are other than h'aa) initial value when these bits are initiated in user boot mode. h'00: initial value when these bits are initiated in a mode except for user boot mode (in user-mat selection state) [programmable condition] these bits are in the executio n state in the on-chip ram. note: * set to 1 when in user boot mode, otherwise set to 0.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 661 of 862 rej09b0429-0100 ? flash transfer destination address register (ftdar) ftdar is a register that specifie s the address to download an on-chip program. this register must be specified before setting the sco bit in fccs to 1. bit bit name initial value r/w description 7 tder 0 r/w transfer destination address setting error this bit is set to 1 when the address specified by bits tda6 to tda0, which is the start address to download an on-chip program, is over t he range. whether or not the range specified by bits tda6 to tda0 is within the range of h'00 to h'03 is determin ed when an on-chip program is downloaded by setting the sco bit in fccs to 1. make sure that this bit is cleared to 0 before setting the sco bit to 1 and the value specified by tda6 to tda0 is within the range of h'00 to h'03. 0: the value specified by bits tda6 to tda0 is within the range. 1: the value specified by is tda6 to tda0 is over the range (h'04 to h'ff) and the download is stopped. 6 5 4 3 2 1 0 tda6 tda5 tda4 tda3 tda2 tda1 tda0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w transfer destination address specifies the start address to download an on-chip program. h'00 to h'03 can be specified as the start address in the on-chip ram space. h'00: h'ffe080 is specifi ed as a start address to download an on-chip program. h'01: h'ff0800 is specified as a start address to download an on-chip program. h'02: h'ff1800 is specified as a start address to download an on-chip program. h'03: h'ff8800 is specified as a start address to download an on-chip program. h'04 to h'ff: setting prohibit ed. specifying this value sets the tder bit to 1 and stops the download.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 662 of 862 rej09b0429-0100 21.3.2 programming/erasing interface parameter the programming/erasing interface parameter speci fies the operating frequ ency, storage place for program data, programming destination address, and erase block and exchanges the processing result for the downloaded on-chip program. this parameter uses the general registers of the cpu (er0 and er1) or the on-chip ram area. the initia l value is undefined at a reset or in hardware standby mode. when download, initialization, or on-chip progra m is executed, registers of the cpu except for r0l are stored. the return value of the processing result is written in r0l. since the stack area is used for storing the registers except for r0l, the st ack area must be saved at the processing start. (a maximum size of a stack area to be used is 128 bytes.) the programming/erasing interface parameter is used in the following four items. 1. download control 2. initialization before programming or erasing 3. programming 4. erasing these items use different parameters. the corre spondence table is shown in table 21.4. the meaning of the bits in fpfr varies in each pro cessing program: initialization, programming, or erasure. for details, see descriptions of fpfr for each process.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 663 of 862 rej09b0429-0100 table 21.4 parameters and target modes name of parameter abbrevia- tion down load initializa- tion program- ming erasure r/w initial value alloca- tion download pass/fail result dpfr ? ? ? r/w undefined on-chip ram * flash pass/fail result fpfr ? r/w undefined r0l of cpu flash programming/ erasing frequency control fpefeq ? ? ? r/w undefined er0 of cpu flash multipurpose address area fmpar ? ? ? r/w undefined er1 of cpu flash multipurpose data destination area fmpdr ? ? ? r/w undefined er0 of cpu flash erase block select febs ? ? ? r/w undefined r0l of cpu note: * a single byte of the start address to downloa d an on-chip program, which is specified by ftdar
section 21 flash memory rev. 1.00 mar. 17, 2008 page 664 of 862 rej09b0429-0100 (1) download control the on-chip program is automatically downloaded by setting the sco bit to 1. the on-chip ram area to be downloaded is the 3-kbyte area star ting from the address specified by ftdar. download control is set by the program/erase interface registers, and the dpfr parameter indicates the return value. (a) download pass/fail result parameter (dpfr: single byte of start address specified by ftdar) this parameter indicates the return value of the download result. the value of this parameter can be used to determine if downloading is executed or not. since the confirmation whether the sco bit is set to 1 is difficult, the certain determinati on must be performed by writing the single byte of the start address specified by ftdar to the value other than the return value of download (for example, h'ff) before the download star t (before setting the sco bit to 1). bit bit name initial value r/w description 7 to 3 ? ? ? unused return 0 2 ss ? r/w source select error detect only one type for the on-chip program which can be downloaded can be specified. when more than two types of the program are se lected, the program is not selected, or the program is selected without mapping, error is occurred. 0: download program can be selected normally 1: download error is occurred (multi-selection or program which is not mapped is selected) 1 fk ? r/w flash key register error detect returns the check result wh ether the value of fkey is set to h'a5. 0: key setting is normal (fkey = h'a5) 1: setting value of fkey becomes error (fkey = value other than h ' a5)
section 21 flash memory rev. 1.00 mar. 17, 2008 page 665 of 862 rej09b0429-0100 bit bit name initial value r/w description 0 sf ? r/w success/fail returns the result whether download is ended normally or not. the determination result whether program that is downloaded to the on-chip ram is read back and then transferred to the on-chip ram is returned. 0: downloading on-chip program is ended normally (no error) 1: downloading on-chip program is ended abnormally (error occurs)
section 21 flash memory rev. 1.00 mar. 17, 2008 page 666 of 862 rej09b0429-0100 (2) programming/erasing initialization the on-chip programming/erasing program to be downloaded includes the initialization program. the specified period pulse must be applied when programming or erasing. the specified pulse width is made by the method in which wait loop is configured by the cpu instruction. the operating frequency of the cpu must be set. the initial program is set as a parameter of the programming/erasing program which has downloaded these settings. (a) flash programming/erasing frequency pa rameter (fpefeq: general register er0 of cpu) this parameter sets the operating frequency of the cpu. the settable range of the operating frequency in this lsi is 20 to 34 mhz. bit bit name initial value r/w description 31 to 16 ? ? ? unused this bit should be cleared to 0. 15 to 0 f15 to f0 ? r/w frequency set set the operating frequency of the cpu. with the pll multiplication function, set the frequency multiplied. the setting value must be calculated as the following methods. 1. the operating frequency which is shown in mhz units must be rounded in a number to three decimal places and be shown in a number of two decimal places. 2. the value multiplied by 100 is converted to the binary digit and is written to the fpefeq parameter (general register er0). for example, when the oper ating frequency of the cpu is 33.000 mhz, the value is as follows. 1. the number to three decim al places of 34.000 is rounded and the value is thus 34.00. 2. the formula that 34.00 100 = 3400 is converted to the binary digit and b'00 00,1101,0100,1000 (h'0d48) is set to er0.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 667 of 862 rej09b0429-0100 (b) flash pass/fail parameter (fpfr : general register r0l of cpu) this parameter indicates the return value of the initialization result. bit bit name initial value r/w description 7 to 2 ? ? ? unused return 0 1 fq ? r/w frequency error detect returns the check result wh ether the specified operating frequency of the cpu is in the range of the supported operating frequency. 0: setting of operating frequency is normal 1: setting of operating frequency is abnormal 0 sf ? r/w success/fail indicates whether initialization is completed normally. 0: initialization is ended normally (no error) 1: initialization is ended abnormally (error occurs) (3) programming execution when flash memory is programmed, the programming destination address on the user mat must be passed to the programming program in which the program data is downloaded. 1. the start address of the programming destination on the user mat must be stored in a general register er1. this parameter is called as fl ash multipurpose address ar ea parameter (fmpar). since the program data is always in units of 128 bytes, the lower eight bits (a7 to a0) must be h'00 or h'80 as the boundary of the programming start address on the user mat. 2. the program data for the user mat must be prepared in the consecutive area. the program data must be in the consecutive space which can be accessed by using the mov.b instruction of the cpu and in other th an the flash memory space. when data to be programmed does not satisfy 128 bytes, the 128-byte program data must be prepared by filling with the dummy code h'ff. the start address of the area in which the prepared program data is stored must be stored in a general register er0. this parameter is called as flash multipurpose data destination area parameter (fmpdr). for details on the program processing procedure, see section 21.4.2, user program mode.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 668 of 862 rej09b0429-0100 (a) flash multipurpose addres s area parameter (fmpar: ge neral register er1 of cpu) this parameter stores the start address of the programming destination on the user mat. when the address in the area other than flas h memory space is set, an error occurs. the start address of the programming destination must be at the 128-byte boundary. if this boundary condition is not satisfied, an error occu rs. the error occurrence is indicated by the wa bit (bit 1) in fpfr. bit bit name initial value r/w description 31 to 0 moa31 to moa0 ? r/w store the start address of the programming destination on the user mat. the consecutive 128-byte programming is executed starti ng from the specified start address of the user mat. therefore, the specified programming start address becomes a 128-byte boundary and moa6 to moa0 are always 0. (b) flash multipurpose data destination parame ter (fmpdr: general register er0 of cpu): this parameter stores the start address in the ar ea which stores the data to be programmed in the user mat. when the storage destination of the pr ogram data is in flash memory, an error occurs. the error occurrence is indicated by the wd bit in fpfr. bit bit name initial value r/w description 31 to 0 mod31 to mod0 ? r/w store the start address of the area which stores the program data for the user mat. the consecutive 128- byte data is programmed to the user mat starting from the specified start address. (c) flash pass/fail parameter (fpfr : general register r0l of cpu) this parameter indicates the return va lue of the program processing result. bit bit name initial value r/w description 7 ? ? ? unused return 0.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 669 of 862 rej09b0429-0100 bit bit name initial value r/w description 6 md ? r/w programming mode related setting error detect returns the check result that a high level signal is input to the fwe pin and the error protection state is not entered. when the low level signal is input to the fwe pin or the error protection stat e is entered, 1 is written to this bit. the state can be confirmed with the fwe and fler bits in fccs. for conditions to enter the error protection state, see secti on 21.5.3, error protection. 0: fwe and fler settings are normal (fwe = 1, fler = 0) 1: programming cannot be performed (fwe = 0 or fler = 1) 5 ee ? r/w programming execution error detect 1 is returned to this bit when the specified data could not be written because the user mat was not erased. if this bit is set to 1, there is a high possibility that the user mat is partially rewritten. in this case, after removing the error factor, erase the user mat. if fmats is set to h'aa and the user boot mat is selected, an error occurs when programming is performed. in this case, both the user mat and user boot mat are not rewritten. pr ogramming of the user boot mat should be performed in boot mode or programmer mode. 0: programming has ended normally 1: programming has ended abnormally (programming result is not guaranteed) 4 fk ? r/w flash key register error detect returns the check result of the value of fkey before the start of the programming processing. 0: fkey setting is normal (fkey = h'5a) 1: fkey setting is error (fkey = value other than h 5a) 3 ? ? ? unused returns 0.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 670 of 862 rej09b0429-0100 bit bit name initial value r/w description 2 wd ? r/w write data address detect when the address in the flash memory area is specified as the start address of the storage destination of the program data, an error occurs. 0: setting of write data address is normal 1: setting of write data address is abnormal 1 wa ? r/w write address error detect when the following items are specified as the start address of the programming dest ination, an error occurs. ? when the programming destination address in the area other than flash memory is specified ? when the specified address is not in a 128-byte boundary. (the lower eight bits of the address are other than h'00 and h'80.) 0: setting of programming destination address is normal 1: setting of programming destination address is abnormal 0 sf ? r/w success/fail indicates whether the program processing is ended normally or not. 0: programming is ended normally (no error) 1: programming is ended abnormally (error occurs)
section 21 flash memory rev. 1.00 mar. 17, 2008 page 671 of 862 rej09b0429-0100 (4) erasure execution when flash memory is erased, the erase-block number on the user mat must be passed to the erasing program which is downloaded. this is set to the febs parameter (general register er0). one block is specified from the block number 0 to 15. for details on the erasing processing procedure, see section 21.4.2, user program mode. (a) flash erase block select paramete r (febs: general register er0 of cpu) this parameter specifies the erase-block number. bit bit name initial value r/w description 31 to 16 ? ? ? unused these bits should be cleared to h 0. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 eb15 eb14 eb13 eb12 eb11 eb10 eb9 eb8 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w erase block set the erase-block number in the range from 0 to 15. 0 corresponds to the eb0 block, and 15 corresponds to the eb15 block.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 672 of 862 rej09b0429-0100 (b) flash pass/fail parameter (fpfr : general register r0l of cpu) this parameter returns value of the erasing processing result. bit bit name initial value r/w description 7 ? ? ? unused return 0. 6 md ? r/w programming mode related setting error detect returns the check result that a high level signal is input to the fwe pin and the error protection state is not entered. when the low level signal is input to the fwe pin or the error protection stat e is entered, 1 is written to this bit. the state can be confirmed with the fwe and fler bits in fccs. for conditions to enter the error protection state, see secti on 21.5.3, error protection. 0: fwe and fler settings are normal (fwe = 1, fler = 0) 1: programming cannot be performed (fwe = 0 or fler = 1) 5 ee ? r/w erasure execution error detect 1 is returned to this bit when the user mat could not be erased or when flash-memory related register settings are partially changed. if this bit is set to 1, there is a high possibility that the user mat is partially erased. in this case, after removing the error factor, erase the user mat. if fmats is set to h'aa and the user boot mat is selected, an error occurs when erasure is performed. in this case, both the user mat and user boot mat are not erased. erasing of the user boot mat should be performed in boot mode or programmer mode. 0: erasure has ended normally 1: erasure has ended abnormally (erasure result is not guaranteed) 4 fk ? r/w flash key register error detect returns the check result of fkey value before start of the erasing processing. 0: fkey setting is normal (fkey = h'5a) 1: fkey setting is error (fkey = value other than h 5a)
section 21 flash memory rev. 1.00 mar. 17, 2008 page 673 of 862 rej09b0429-0100 bit bit name initial value r/w description 3 eb ? r/w erase block select error detect returns the check result wh ether the specified erase- block number is in the block range of the user mat. 0: setting of erase-block number is normal 1: setting of erase-block number is abnormal 2, 1 ? ? ? unused return 0. 0 sf ? r/w success/fail indicates whether the erasing processing is ended normally or not. 0: erasure is ended normally (no error) 1: erasure is ended abnormally (error occurs) 21.4 on-board programming mode when the pin is set in on-board programming mode and the reset start is executed, the on-board programming state that can prog ram/erase the on-chip flash memory is entered. on-board programming mode has three operating modes: b oot mode, user program mode, and user boot mode. for details of the pin setting for entering each mode, see table 21.5. for details of the state transition of each mode for fl ash memory, see figure 21.2. table 21.5 setting on-board programming mode mode setting fwe md2 md1 md0 nmi boot mode 1 0 0 0 1 user program mode 1 * 1 1 0 0/1 user boot mode 1 0 0 0 0 note: * before downloading the programming/erasing programs, the flshe bit must be set to 1 to transition to user program mode.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 674 of 862 rej09b0429-0100 21.4.1 boot mode boot mode executes programming/erasing user mat and user boot mat by means of the control command and program data transmitted from the host using the on-chip sci. the tool for transmitting the control command and program data must be prepared in the host. the sci communication mode is set to asynchronous mode . when reset start is executed after this lsi?s pin is set in boot mode, the boot program in the mi crocomputer is initiated. after the sci bit rate is automatically adjusted, the co mmunication with the host is ex ecuted by means of the control command method. the system configuration diagram in boot mode is shown in figure 21.6. for details on the pin setting in boot mode, see table 21.5. the nmi and other interrupts are ignored in boot mode. however, the nmi and other interrupts should be disabled in the user system. host rxd1 t xd1 control command, analysis execution software (on-chip) flash memory on-chip ram on-chip sci_1 this lsi boot programming tool and program data control command, program data reply response figure 21.6 system configuration in boot mode
section 21 flash memory rev. 1.00 mar. 17, 2008 page 675 of 862 rej09b0429-0100 (1) sci interface setting by host when boot mode is initiated, this lsi measur es the low period of asynchronous sci-communica- tion data (h'00), which is transmitted consecutivel y by the host. the sci transmit/receive format is set to 8-bit data, 1 stop bit, and no parity. this lsi calculates the bit rate of transmission by the host by means of the measured low period and transmits the bit adjustment end sign (1 byte of h'00) to the host. the host must confirm that this bit adjustment end sign (h'00) has been received normally and transmits 1 byte of h'55 to this ls i. when reception is not executed normally, boot mode is initiated again (reset) and the operation described above must be executed. the bit rate between the host and this lsi is not matched by the bit rate of transmission by the host and system clock frequency of this lsi. to operate the sci normally, the transfer bit rate of the host must be set to 9,600 bps or 19,200 bps. the system clock frequency, which can automatically adjust the transfer b it rate of the host and the bit rate of this lsi, is shown in table 21.6. boot mode must be initiated in the range of this system clock. d0 d1 d2 d3 d4 d5 d6 d7 start bit stop bit measure low period (9 bits) (data is h'00) high period of at least 1 bit figure 21.7 automatic-bit-rate adjustment operation of sci table 21.6 system clock frequency for auto matic-bit-rate adjustment by this lsi bit rate of host system clock frequency 9,600 bps 20 to 34 mhz 19,200 bps
section 21 flash memory rev. 1.00 mar. 17, 2008 page 676 of 862 rej09b0429-0100 (2) state transition diagram the overview of the state transition diagram after boot mode is initiated is shown in figure 21.8. 1. bit rate adjustment after boot mode is initiated, the bit rate of the sci interface is adjusted with that of the host. 2. waiting for inquiry set command for inquiries about user-mat size and configura tion, mat start address, and support state, the required information is transmitted to the host. 3. automatic erasure of all user mat and user boot mat after inquiries have finished, all user mat and user boot mat are automatically erased. 4. waiting for programming/erasing command ? when the program preparation notice is receiv ed, the state for waiting program data is entered. the programming start address and program data must be transmitted following the programming command. when programming is finished, the programming start address must be set to h'ffffffff and transmitted. then the state for waiting program data is returned to the state of pr ogramming/erasing command wait. ? when the erasure preparation no tice is received, the state for waiting erase-block data is entered. the erase-block number must be transmitted following the erasing command. when the erasure is finished, the erase-block number must be set to h'ff and transmitted. then the state for waiting erase-block data is returned to th e state for waiting programming/erasing command. the erasure must be used when the specified block is programmed without a reset start after programming is executed in boot mode. when programming can be executed by only one operation, all blocks are erased before the state for waiting programming/erasing/other command is entered. the erasing operation is not required. ? there are many commands other than prog ramming/erasing. examples are sum check, blank check (erasure check), and memory re ad of the user mat/user boot mat and acquisition of current status information. note that memory read of the user mat/user b oot mat can only read the programmed data after all user mat/user boot mat has automatically been erased.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 677 of 862 rej09b0429-0100 wait for inquiry setting command wait for programming/erasing command bit rate adjustment processing of read/check command boot mode initiation (reset by boot mode) h'00.......h'00 reception h'00 transmission (adjustment completed) (bit rate adjustment) processing of inquiry setting command all user mat and user boot mat erasure wait for program data wait for erase-block data read/check command reception command response (program command reception) (program data transmission) (erasure selection command reception) (program end notice) (erase-block specification) (erasure end notice) inquiry command reception h'55 reception inquiry command response 1. 2. 3. 4. figure 21.8 overview of boot mode state transition diagram
section 21 flash memory rev. 1.00 mar. 17, 2008 page 678 of 862 rej09b0429-0100 21.4.2 user program mode the user mat can be programmed/erased in user program mode. (the user boot mat cannot be programmed/erased.) programming/erasing is executed by downlo ading the program in the microcomputer. the overview flow is shown in figure 21.9. high voltage is applied to internal flash memory during the programming/erasing processing. therefore, transition to reset or hardware standby must not be executed. doing so may damage or destroy flash memory. if reset is executed accidentally, reset must be released after the reset input period of 100 s which is longer than normal. when programming, program data is prepared programming/erasing procedure program is transferred to the on-chip ram and executed programming/erasing start programming/erasing end make sure that the program data will not overlap the download destination specified by ftdar. the fwe bit is set to 1 by inputting a high level signal to the fwe pin. programming/erasing is executed only in the on-chip ram. however, if program data is in a consecutive area and can be accessed by the mov.b instruction of the cpu like ram or rom, the program data can be in an external space. after programming/erasing is finished, input a low level signal to the fwe pin and transfer to the hardware protection state. 1. 2. 3. 4. figure 21.9 programmin g/erasing overview flow
section 21 flash memory rev. 1.00 mar. 17, 2008 page 679 of 862 rej09b0429-0100 (1) on-chip ram address map when programming/erasing is executed parts of the procedure program that are made by the user, like download request, programming/erasing procedure, and determination of the result, must be executed in the on-chip ram. the on-chip program that is to be downloaded is all in the on-chip ram. note that area in the on-chip ram must be controlled so that these parts do not overlap. figure 21.10 shows the program area to be downloaded. system use area (15 bytes) < on-chip ram > address area to be downloaded (size : 3 kbytes) unusable area in programming/erasing processing period area that can be used by user * dpfr (return value: 1 byte) programming/erasing program entry initialization program entry initialization + programming program or initialization + erasing program area that can be used by user * note: * the on-chip ram area in this lsi is split into h'ff0800 to h'ff97ff, h'ffe080 to h'ffefff, and h'ffff00 to h'ffff7f. the area that can be used by the user is specified by ftdar. ramtop ftdar setting ftdar setting + 16 ftdar setting + 32 ftdar setting + 3 kbytes ramend figure 21.10 ram map when pr ogramming/erasing is executed
section 21 flash memory rev. 1.00 mar. 17, 2008 page 680 of 862 rej09b0429-0100 (2) programming procedure in user program mode the procedures for download, initialization, an d programming are shown in figure 21.11. select on-chip program to be downloaded and specify download destination by ftdar set fkey to h'a5 set sco to 1 and execute download dpfr = 0? yes no download error processing set the fpefeq parameter yes end programming procedure program fpfr = 0? no disable interrupts and bus master operation other than cpu clear fkey to 0 programming jsr ftdar setting + 16 yes fpfr = 0? no clear fkey and programming error processing yes required data programming is completed? no set fkey to h'5a clear fkey to 0 1. 2. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 1 1 3. download initialization programming initialization jsr ftdar setting + 32 initialization error processing set parameters to er1 and er0 (fmpar and fmpdr) start programming procedure program figure 21.11 programming procedure the procedure program must be executed in an area other than the flash memory to be programmed. especially the part where the sco bit in fccs is set to 1 for downloading must be executed in the on-chip ram. the area that can be executed in the steps of the user procedure program (on-chip ram, user mat, and external space) is shown in section 21.4.4, procedure program and storable area for programming data. the following description assume s the area to be programmed on the user mat is erased and program data is prepared in the consecutive ar ea. when erasing is no t executed, erasing is executed before writing.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 681 of 862 rej09b0429-0100 128-byte programming is performed in one program processing. when more than 128-byte programming is performed, programming destina tion address/program data parameter is updated in 128-byte units and programming is repeated. when less than 128-byte programming is performed, data must total 128 bytes by adding the invalid data. if the dummy data to be added is h'ff, the program processing period can be shortened. 1. select the on-chip program to be downloaded and specify a download destination when the ppvs bit of fpcs is set to 1, the programming program is selected. several programming/erasing programs cannot be selected at one time. if several programs are set, download is not performed and a download error is returned to the ss bit in dpfr. the start address of a download destination is specified by ftdar. 2. program h'a5 in fkey if h'a5 is not written to fkey for protection, 1 cannot be set to the sco bit for download request. 3. 1 is set to the sco bit of fccs and then download is executed. to set 1 to the sco bit, the following conditions must be satisfied. ? h'a5 is written to fkey. ? the sco bit writing is executed in the on-chip ram. when the sco bit is set to 1, download is started automatically. when the sco bit is returned to the user procedure program, the sco is cl eared to 0. therefore, the sco bit cannot be confirmed to be 1 in the user procedure program. the download result can be confirmed only by the return value of dpfr. before the sco bit is set to 1, incorrect determination must be prevented by setting the one byte of the start address (to be used as dpfr) specified by ftdar to a value other than the return value (e.g. h'ff). when download is executed, particular interrup t processing, which is accompanied by the bank switch as described below, is performed as an internal microcomputer processing. four nop instructions are executed imme diately after the instructions that set the sco bit to 1. ? the user-mat space is switched to the on-chip program storage area. ? after the selection condition of the download program and the ftdar setting are checked, the transfer processing to the on-chi p ram specified by ftdar is executed. ? the sco bit in fccs is cleared to 0. ? the return value is set to the dpfr parameter.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 682 of 862 rej09b0429-0100 ? after the on-chip program storage area is re turned to the user-mat space, the user procedure program is returned. ? in the download processing, the values of general registers of the cpu are held. ? in the download processing, any interrupts are not accepted. however, interrupt requests are held. therefore, wh en the user procedure program is returned, the inte rrupts occur. ? when the level-detection interrupt requests are to be held, interrupts must be input until the download is ended. ? when hardware standby mode is entered during download processing, the normal download cannot be guaranteed in the on-chip ram. therefore, download must be executed again. ? since a stack area of 128 bytes at the maximum is used, the ar ea must be allocated before setting the sco bit to 1. ? if a flash memory access by the dtc signal is re quested during downlo ading, the operation cannot be guaranteed. therefore, an access request by the dtc signal must not be generated. 4. fkey is cleared to h'00 for protection. 5. the value of the dpfr parameter must be checked and the download result must be confirmed. ? check the value of the dpfr parameter (one byte of start address of the download destination specified by ftdar). if the value is h'00, download has been performed normally. if the value is not h'00, the sour ce that caused download to fail can be investigated by the description below. ? if the value of the dpfr parameter is the same as before downloading (e.g. h'ff), the address setting of the download destination in ftdar may be abnormal. in this case, confirm the setting of the tder bit (bit 7) in ftdar. ? if the value of the dpfr parameter is different from before downloading, check the ss bit (bit 2) and the fk bit (bit 1) in the dpfr parameter to ensure that the download program selection and fkey setting were normal, respectively. 6. the operating frequency is set in th e fpefeq parameter for initialization. ? the current frequency of the cpu clock is set to the fpefeq parameter value (general register er0). the settable range of the fpefeq parameter is 21 to 34 mhz. when the frequency is set to out of this range, an error is returned to the fpfr parameter of the initialization program and initialization is not performed. for details on the frequency setting, see the description in 21.3.2 (2) (a), flash programming/era sing frequency parameter (fpefeq: general register er0 of cpu).
section 21 flash memory rev. 1.00 mar. 17, 2008 page 683 of 862 rej09b0429-0100 7. initialization when a programming program is downloaded, the initialization program is also downloaded to the on-chip ram. there is an entry point of th e initialization program in the area from the start address specified by ftdar + 32 bytes of the on-chip ram. the subroutine is called and initialization is executed by using the following steps. mov.l #dltop+32,er2 ; set entry address to er2 jsr @er2 ; call initialization routine nop ? the general registers other than r0l are held in the initialization program. ? r0l is a return value of the fpfr parameter. ? since the stack area is used in the initialization program, 128-byte stack area at the maximum must be allocated in ram. ? interrupts can be accepted during the execution of the initialization program. the program storage area and stack area in the on-chip ram and register values must not be destroyed. 8. the return value in the initialization program, fpfr (general register r0l) is determined. 9. all interrupts and the use of a bus master other than the cpu are prohibited. the specified voltage is applied for the speci fied time when programmi ng or erasing. if interrupts occur or the bus mastership is moved to other than the cpu during this time, the voltage for more than the specified time will be applied and flash memory may be damaged. therefore, interrupts and bus ma stership to other than the cp u, such as to the dtc, are prohibited. to disable interrupts, bit 7 (i) in the condition code register (ccr) of the cpu should be set to b'1 in interrupt control mode 0 or bits 7 and 6 (i and ui) should be set to b'11 in interrupt control mode 1. interrupts other than nmi are held and not executed. the nmi interrupts must be masked within the user system. the interrupts that are held must be executed after all program processing. when the bus mastership is moved to other th an the cpu, such as to the dtc, the error protection state is entered. therefore, taking bus mastership by the dtc is prohibited. 10. fkey must be set to h 5a and the user mat must be prepared for programming.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 684 of 862 rej09b0429-0100 11. the parameter which is required for programming is set. the start address of the programming destination of the user mat (fmpar) is set to general register er1. the start address of the program data area (fmpdr) is set to general register er0. ? example of the fmpar setting fmpar specifies the programming destination address. when an address other than one in the user mat area is specified, even if the programming program is executed, programming is not executed and an error is returned to the return value parameter fpfr. since the unit is 128 bytes, the lower eight bits of the address must be h'00 or h'80 as the boundary of 128 bytes. ? example of the fmpdr setting when the storage destination of the program data is flash memory, even if the program execution routine is executed, pr ogramming is not executed and an error is returned to the fpfr parameter. in this case, the program da ta must be transferred to the on-chip ram and then programming must be executed. 12. programming there is an entry point of the programming prog ram in the area from the start address specified by ftdar + 16 bytes of the on-chip ram. the subroutine is called and programming is executed by using the following steps. mov.l #dltop+16,er2 ; set entry address to er2 jsr @er2 ; call programming routine nop ? the general registers other than r0l are held in the programming program. ? r0l is a return value of the fpfr parameter. ? since the stack area is used in the programming program, a stack area of 128 bytes at the maximum must be allocated in ram. 13. the return value in the programming program, fpfr (general register r0l) is determined. 14. determine whether programming of the necessary data has finished. if more than 128 bytes of data are to be programmed, specify fmpar and fmpdr in 128- byte units, and repeat steps 12 to 14. increment the programming destination address by 128 bytes and update the programming data pointer correctly. if an address which has already been programmed is written to again, not only w ill a programming error occur, but also flash memory will be damaged.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 685 of 862 rej09b0429-0100 15. after programming finishes, clear fk ey and specify software protection. if this lsi is restarted by a reset immediat ely after user mat programming has finished, secure the reset period (period of res = 0) of 100 s which is longer than normal. (3) erasing procedure in user program mode the procedures for download, initialization, and erasing are shown in figure 21.12. set fkey to h'a5 set sco to 1 and execute download dpfr = 0? yes no download error processing set the fpefeq parameter yes end erasing procedure program fpfr = 0 ? no initialization error processing disable interrupts and bus master operation other than cpu clear fkey to 0 set febs parameter yes fpfr = 0 ? no clear fkey and erasing error processing yes required block erasing is completed? no set fkey to h'5a clear fkey to 0 1. 2. 3. 4. 5. 6. 1 1 download initialization erasing initialization jsr ftdar setting + 32 erasing jsr ftdar setting + 16 select on-chip program to be downloaded and specify download destination by ftdar start erasing procedure program figure 21.12 erasing procedure the procedure program must be executed in an area other than the user mat to be erased. especially the part where the sco bit in fccs is set to 1 for downloading must be executed in the on-chip ram. the area that can be executed in the steps of the user procedure program (on-chip ram, user mat, and external space) is shown in section 21.4.4, procedure program and storable area for programming data.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 686 of 862 rej09b0429-0100 for the downloaded on-chip program area, refer to the ram map for programming/erasing in figure 21.10. a single divided block is erased by one erasing processing. for block divisions, refer to figure 21.4. to erase two or more blocks, update the erase block number and perform the erasing processing for each block. 1. select the on-chip program to be downloaded set the epvb bit in fecs to 1. several programming/erasing programs cannot be selected at one time. if several programs are set, download is not performed and a download error is reported to the ss bit in the dpfr parameter. specify the start address of a do wnload destination by ftdar. the procedures to be carried out after setting fkey, e.g. download and initialization, are the same as those in the programming procedure. for details, refer to section 21.4.2 (2), programming procedure in user program mode. the procedures after setting parameters for erasing programs are as follows: 2. set the febs parameter necessary for erasure set the erase block number of the user mat in the flash eras e block select parameter febs (general register er0). if a valu e other than an erase block number of the user mat is set, no block is erased even though the erasing program is executed, and an error is returned to the return value parameter fpfr. 3. erasure similar to as in programming, th ere is an entry point of the erasing program in the area from the start address of a download destination specified by ftdar + 16 bytes of on-chip ram. the subroutine is called and erasing is executed by using the following steps. mov.l #dltop+16,er2 ; set entry address to er2 jsr @er2 ; call erasing routine nop  the general registers other than r0l are held in the erasing program.  r0l is a return value of the fpfr parameter.  since the stack area is used in the erasin g program, a stack area of 128 bytes at the maximum must be allocated in ram. 4. the return value in the er asing program, fpfr (general register r0l) is determined.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 687 of 862 rej09b0429-0100 5. determine whether erasure of the necessary blocks has completed. if more than one block is to be erased, update the febs parameter and repeat steps 2 to 5. blocks that have already been erased can be erased again. 6. after erasure completes, clear fk ey and specify software protection. if this lsi is restarted by a reset immediately after user mat erasure has completed, secure the reset period (period of res = 0) of 100 s which is longer than normal. (4) erasing and programming pr ocedure in user program mode by changing the on-chip ram address of the download destination in ftdar, the erasing program and programming program can be downloaded to separate on-chip ram areas. figure 21.13 shows a repeating procedure of erasing and programming. yes no 1 1 erasing program download programming program download erasing/ programming start procedure program specify a download destination of erasing program by ftdar download erasing program initialize erasing program specify a download destination of programming program by ftdar download programming program initialize programming program end procedure program erase relevant block (execute erasing program) set fmpdr to program relevant block (execute programming program) confirm operation end ? figure 21.13 repeating procedure of erasing and programming in the above procedure, download and initialization are performed only once at the beginning. in this kind of operation, note the following:
section 21 flash memory rev. 1.00 mar. 17, 2008 page 688 of 862 rej09b0429-0100 ? be careful not to damage on-chip ram with overlapped settings. in addition to the erasing pr ogram area and programming prog ram area, areas for the user procedure programs, work area, and stack area are reserved in on-chip ram. do not make settings that will overwrite data in these areas. ? be sure to initialize both the erasing program and programming program. initialization by setting the fpefeq parameter must be performed for both the erasing program and the programming program. initialization must be executed for both entry addresses: (download start address for erasing program) + 32 bytes and (download start address for programming program) + 32 bytes.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 689 of 862 rej09b0429-0100 21.4.3 user boot mode this lsi has user boot mode which is initiated with different mode pin settings than those in boot mode or user program mode. user boot mode is a user-arbitrary boot mode, unlike boot mode that uses the on-chip sci. only the user mat can be programmed/erased in user boot mode. programming/erasing of the user boot mat is only enabled in boot mode or programmer mode. (1) user boot mode initiation for the mode pin settings to start up user boot mode, see table 21.5. when the reset start is executed in user boot mo de, the built-in check routine runs. the user mat and user boot mat states are ch ecked by this check routine. while the check routine is running, nmi and all other interrupts cannot be accepted. next, processing starts from the execution start address of the reset vector in the user boot mat. at this point, h aa is set to fmats because the exec ution mat is the user boot mat. (2) user mat programming in user boot mode for programming the user mat in user boot mode, additional processing made by setting fmats are required: switching from user-boot-mat sel ection state to user-mat selection state, and switching back to user-boot-mat selection state after programming completes. figure 21.14 shows the procedure for programming the user mat in user boot mode.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 690 of 862 rej09b0429-0100 set fkey to h'a5 dpfr = 0 ? yes no download error processing set the fpefeq parameters initialization jsr ftdar setting + 32 yes end programming procedure program fpfr = 0 ? no initialization error processing disable interrupts and bus master operation other than cpu clear fkey to 0 set parameter to er0 and er1 (fmpar and fmpdr) programming jsr ftdar setting + 16 yes fpfr = 0 ? no yes required data programming is completed? no set fkey to h'a5 clear fkey to 0 1 1 download initialization programming mat switchover mat switchover set fmats to value other than h'aa to select user mat set sco to 1 and execute download clear fkey and programming error processing set fmats to h'aa to select user boot mat user-boot-mat selection state user-mat selection state user-boot-mat selection state note: the mat must be switched by fmats to perform the programming error processing in the user boot mat. start programming procedure program select on-chip program to be downloaded and specify download destination by ftdar figure 21.14 procedu re for programming user ma t in user boot mode the difference between the programming procedures in user program mode and user boot mode is whether the mat is switched or not as shown in figure 21.14. in user boot mode, the user b oot mat can be seen in the flas h memory space with the user mat hidden in the background. the user mat and us er boot mat are switched only while the user mat is being programmed. because the user boot mat is hidden while the user mat is being programmed, the procedure program must be locat ed in an area other than flash memory. after programming completes, switch the mats again to return to the first state. mat switching is enabled by writing a specific value to fmats. however note that while the mats are being switched, the lsi is in an unstabl e state, e.g. access to a mat is not allowed until mat switching is completed, and if an interrupt occurs, from which mat the interrupt vector is
section 21 flash memory rev. 1.00 mar. 17, 2008 page 691 of 862 rej09b0429-0100 read is undetermined. perform mat switching in accordance with the description in section 21.6, switching between user mat and user boot mat. except for mat switching, the programming procedure is the same as that in user program mode. the area that can be executed in the steps of the user procedure program (on-chip ram, user mat, and external space) is shown in section 21.4.4, procedure program and storable area for programming data.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 692 of 862 rej09b0429-0100 (3) user mat erasing in user boot mode for erasing the user mat in user boot mode, additional processing made by setting fmats are required: switching from user-boot-mat selec tion state to user-mat selection state, and switching back to user-boot-mat selection state after erasing completes. figure 21.15 shows the procedure for erasing the user mat in user boot mode. yes no start erasing procedure program set fkey to h'a5 yes no download error processing set the fpefeq parameters end erasing procedure program fpfr = 0 ? initialization error processing disable interrupts and bus master operation other than cpu clear fkey to 0 set febs parameter yes no clear fkey and erasing error processing yes required block erasing is completed? no set fkey to h'a5 clear fkey to 0 1 1 download initialization erasing set fmats to value other than h'aa to select user mat set sco to 1 and execute download set fmats to h'aa to select user boot mat user-boot-mat selection state user-mat selection state user-boot-mat selection state note: the mat must be switched by fmats to perform the erasing error processing in the user boot mat. mat switchover mat switchover dpfr = 0 ? initialization jsr ftdar setting + 32 programming jsr ftdar setting + 16 fpfr = 0 ? select on-chip program to be downloaded and specify download destination by ftdar figure 21.15 procedure for eras ing user mat in user boot mode the difference between the erasing procedures in user program mode and user boot mode depends on whether the mat is switched or not as shown in figure 21.15.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 693 of 862 rej09b0429-0100 mat switching is enabled by writing a specific value to fmats. however note that while the mats are being switched, the lsi is in an unstabl e state, e.g. access to a mat is not allowed until mat switching is completed, and if an interrupt occurs, from which mat th e interrupt vector is read is undetermined. perform mat switching in accordance with the description in section 21.6, switching between user mat and user boot mat. except for mat switching, the erasing procedure is the same as that in user program mode. the area that can be executed in the steps of the user procedure program (on-chip ram, user mat, and external space) is shown in section 21.4.4, procedure program and storable area for programming data.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 694 of 862 rej09b0429-0100 21.4.4 procedure program and storable area for programming data in the descriptions in the previous section, the programming/erasing procedure programs and storable areas for program data are assumed to be in the on-chi p ram. however, the program and the data can be stored in and executed from other areas, such as part of flash memory which is not to be programmed or erased, or some where in the extern al address space. (1) conditions that apply to programming/erasing 1. the on-chip programming/erasing program is downloaded from the address in the on-chip ram specified by ftdar, therefore, this area is not available for use. 2. the on-chip programming/erasing program will use 128 bytes at the maximum as a stack. so, make sure that this area is secured. 3. download by setting the sco bit to 1 will lead to switching of the mat. if, therefore, this operation is used, it should be executed from the on-chip ram. 4. the flash memory is accessible until the start of prog ramming or erasing, that is, until the result of downloading has been determined. when in a mode in which the external address space is not accessible, such as single-chi p mode, the required pr ocedure programs, nmi handling vector and nmi handler should be transferred to the on-chip ram before programming/erasing of the flash memory starts. 5. the flash memory is not acce ssible during programming/erasing operations, therefore, the operation program is downloaded to the on-chip ram to be executed. the nmi-handling vector and programs such as that which ac tivate the operation prog ram, and nmi handler should thus be stored in on-chip memory other than flash memory or the external address space. 6. after programming/erasing, the flash memory should be inhibited until fkey is cleared. the reset state ( res = 0) must be in place for more than 100 s when the lsi mode is changed to reset on completion of a programming/erasing operation. transitions to the reset state, and hardware standby mode are inhibited during programming/erasing. when the re set signal is accidentally input to the chip, a longer period in the reset state than usual (100 s) is needed before the reset signal is released. 7. switching of the mats by fmats should be needed when programming/erasing of the user boot mat is operated in user-boot mode. the program which switches the mats should be executed from the on-chip ram. see section 21.6, switching between user mat and user boot mat. please make sure you know which mat is selected when switching between them. 8. when the data storable area indicated by programming parameter fmpdr is within the flash memory area, an error will occur even when the data stored is normal. therefore, the data
section 21 flash memory rev. 1.00 mar. 17, 2008 page 695 of 862 rej09b0429-0100 should be transferred to the on-chip ram to place the address that fmpdr indicates in an area other than the flash memory. in consideration of these conditions, there are thre e factors; operating mode , the bank structure of the user mat, and operations. the areas in which the programming data can be stored for execution are shown in tables. table 21.7 executable mat initiated mode operation user program mode user boot mode * programming table 21.8 (1) table 21.8 (3) erasing table 21.8 (2) table 21.8 (4) note: * programming/erasing is possible to user mats.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 696 of 862 rej09b0429-0100 table 21.8 (1) useable area for pr ogramming in user program mode storable /executable area selected mat item on-chip ram user mat external space (expanded mode) user mat embedded program storage area storage area for program data * ? ? operation for selection of on-chip program to be downloaded operation for writing h'a5 to fkey execution of writing sco = 1 to fccs (download) operation for fkey clear determination of download result operation for download error operation for settings of initial parameter execution of initialization determination of initialization result operation for initialization error nmi handling routine operation for inhibit of interrupt operation for writing h'5a to fkey operation for settings of program parameter
section 21 flash memory rev. 1.00 mar. 17, 2008 page 697 of 862 rej09b0429-0100 storable /executable area selected mat item on-chip ram user mat external space (expanded mode) user mat embedded program storage area execution of programming determination of program result operation for program error operation for fkey clear note: * transferring the data to the on-chip ram enables this area to be used.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 698 of 862 rej09b0429-0100 table 21.8 (2) useable area for erasure in user program mode storable /executable area selected mat item on-chip ram user mat external space (expanded mode) user mat embedded program storage area operation for selection of on-chip program to be downloaded operation for writing h'a5 to fkey execution of writing sco = 1 to fccs (download) operation for fkey clear determination of download result operation for download error operation for settings of initial parameter execution of initialization determination of initialization result operation for initialization error nmi handling routine operation for inhibit of interrupt operation for writing h'5a to fkey operation for settings of erasure parameter execution of erasure determination of erasure result
section 21 flash memory rev. 1.00 mar. 17, 2008 page 699 of 862 rej09b0429-0100 storable /executable area selected mat item on-chip ram user mat external space (expanded mode) user mat embedded program storage area operation for erasure error operation for fkey clear
section 21 flash memory rev. 1.00 mar. 17, 2008 page 700 of 862 rej09b0429-0100 table 21.8 (3) useable area for programming in user boot mode storable/executable area selected mat item on-chip ram user boot mat external space (expanded mode) user mat user boot mat embedded program storage area storage area for program data * 1 ? ? ? operation for selection of on-chip program to be downloaded operation for writing h'a5 to fkey execution of writing sco = 1 to fccs (download) operation for fkey clear determination of download result operation for download error operation for settings of initial parameter execution of initialization determination of initialization result operation for initialization error nmi handling routine operation for interrupt inhibit switching mats by fmats operation for writing h'5a to fkey
section 21 flash memory rev. 1.00 mar. 17, 2008 page 701 of 862 rej09b0429-0100 storable/executable area selected mat item on-chip ram user boot mat external space (expanded mode) user mat user boot mat embedded program storage area operation for settings of program parameter execution of programming determination of program result operation for program error * 2 operation for fkey clear switching mats by fmats notes: 1. transferring the data to the on -chip ram enables this area to be used. 2. switching fmats by a program in the on-chip ram enables this area to be used.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 702 of 862 rej09b0429-0100 table 21.8 (4) useable area fo r erasure in user boot mode storable/executable area selected mat item on-chip ram user boot mat external space (expanded mode) user mat user boot mat embedded program storage area operation for selection of on-chip program to be downloaded operation for writing h'a5 to fkey execution of writing sco = 1 to fccs (download) operation for fkey clear determination of download result operation for download error operation for settings of initial parameter execution of initialization determination of initialization result operation for initialization error nmi handling routine operation for interrupt inhibit switching mats by fmats operation for writing h'5a to fkey
section 21 flash memory rev. 1.00 mar. 17, 2008 page 703 of 862 rej09b0429-0100 storable/executable area selected mat item on-chip ram user boot mat external space (expanded mode) user mat user boot mat embedded program storage area operation for settings of erasure parameter execution of erasure determination of erasure result operation for erasure error * operation for fkey clear switching mats by fmats note: * switching fmats by a program in the on- chip ram enables this area to be used.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 704 of 862 rej09b0429-0100 21.5 protection there are three kinds of flash memory program/erase protection: hardware, software, and error protection. 21.5.1 hardware protection programming and erasing of flash memory is forcibly disabled or suspended by hardware protection. in this state, the downloading of an on-chip program and initialization are possible. however, an activated program for programming or erasure cannot program or erase locations in a user mat, and the error in programming/er asing is reported in the parameter fpfr.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 705 of 862 rej09b0429-0100 table 21.9 hardware protection function to be protected item description download program/erase fwe pin protection ? when a low level signal is input to the fwe pin, the fwe bit in fccs is cleared and the program/erase- protected stat e is entered. ? reset/standby protection ? the program/erase interface registers are initialized in the reset state (including a reset by the wdt) and standby mode and the program/erase- protected stat e is entered. ? the reset state will not be entered by a reset using the res pin unless the res pin is held low until oscillation has stabilized after power is initially supplied. in the case of a reset during operation, hold the res pin low for the res pulse width that is specified in the section on ac characteristics section. if a reset is input during programming or erasure, data values in the flash memory are not guaranteed. in this case, execute erasure and then execute program again.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 706 of 862 rej09b0429-0100 21.5.2 software protection software protection is set up in any of two ways: by disabling the downloading of on-chip programs for programming and erasing and by means of a key code. table 21.10 software protection function to be protected item description download program/erase protection by the sco bit ? the program/erase-protected state is entered by clearing the sco bit in fccs which disables the downloading of the programming/erasing programs. protection by the fkey register ? downloading and programming/erasing are disabled unless the required key code is written in fkey. different key codes are used for downloading and for programming/erasing. 21.5.3 error protection error protection is a mechanism for aborting programming or erasure when an error occurs, in the form of the microcomputer entering runaway duri ng programming/erasing of the flash memory or operations that are not according to the establis hed procedures for prog ramming/erasing. aborting programming or erasure in such cases prevents damage to the flash memory due to excessive programming or erasing. if the microcomputer malfunctions during programming/erasing of the flash memory, the fler bit in the fccs register is set to 1 and the erro r-protection state is entered, and this aborts the programming or erasure. the fler bit is set in the following conditions: 1. when an interrupt such as nmi occurs during programming/erasing. 2. when the flash memory is read during programming/erasing (including a vector read or an instruction fetch). 3. when a sleep instruction (including software-standby mode) is executed during programming/erasing.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 707 of 862 rej09b0429-0100 4. when a bus master other than the cpu, such as the dtc, gets bus mastership during programming/erasing. error protection is cancelled only by a reset or by hardware-standby mode. note that the reset should be released after the reset period of 100 s which is longer than normal. since high voltages are applied during programming/erasing of the flash memory, some voltage may remain after the error-protection state has been entered. fo r this reason, it is necessary to reduce the risk of damage to the flash memory by extending the reset period so that the charge is released. the state-transition diagram in figure 21.16 shows transitions to and from the error-protection state. reset or hardware standby (hardware protection) program mode erase mode error protection mode error-protection mode (software standby) read disabled programming/erasing enabled fler = 0 read disabled programming/erasing disabled fler = 0 read enabled programming/erasing disabled fler = 1 read disabled programming/erasing disabled fler = 1 res = 0 or stby = 0 error occurrence error occurred (software standby) res = 0 or stby = 0 software-standby mode cancel software-standby mode res = 0 or stby = 0 program/erase interface register is in its initial state. program/erase interface register is in its initial state. figure 21.16 transitions to error-protection state
section 21 flash memory rev. 1.00 mar. 17, 2008 page 708 of 862 rej09b0429-0100 21.6 switching between user mat and user boot mat it is possible to alternate between the user ma t and user boot mat. however, the following procedure is required because these mats are allocated to address 0. (switching to the user boot mat disables programming and erasing. programming of the user boot mat should take place in bo ot mode or programmer mode.) 1. mat switching by fmats should always be executed from the on-chip ram. 2. to ensure that the mat that has been switched to is accessible, execute four nop instructions in the on-chip ram immediately after writing to fmats of the on-chip ram (this prevents access to the flash memory during mat switching). 3. if an interrupt has occurred during switching, there is no guarantee of which memory mat is being accessed. always mask the maskable inte rrupts before switching between mats. in addition, configure the system so that nmi interrupts do not occur during mat switching. 4. after the mats have been switched, take care because the interrupt vector table will also have been switched. if interrupt processing is to be the same before and after mat switching, transfer the interrupt-processing routines to the on-chip ram and set the weinte bit in fccs to place the inte rrupt-vector table in the on-chip ram. 5. memory sizes of the user mat and user boot mat are different. when accessing the user boot mat, do not access addresses above the top of its 16-kbyte memory space. if access goes beyond the 16-kbyte space, the values read are undefined. < user mat >< on-chip ram >< user boot mat > procedure for switching to the user boot mat procedure for switching to the user mat procedure for switching to the user boot mat (1) mask interrupts (2) write h'aa to fmats. (3) execute four nop instructions before accessing the user boot mat. procedure for switching to the user mat (1) mask interrupts (2) write a value other than h'aa to fmats. (3) execute four nop instructions before accessing the user mat. figure 21.17 switching between the user mat and user boot mat
section 21 flash memory rev. 1.00 mar. 17, 2008 page 709 of 862 rej09b0429-0100 21.7 programmer mode along with its on-board programming mode, this lsi also has a programmer mode as a further mode for the programming and erasing of programs and data. in the programmer mode, a general- purpose prom programmer can freely be used to write programs to the on-chip rom. program/erase is possible on th e user mat and user boot mat* 1 . the prom programmer must support microcomputers with 256 or 512-kbyte flash memory as a device type* 2 . a status-polling system is adopted for operati on in automatic program, automatic erase, and status-read modes. in the status-read mode, details of the system?s internal signals are output after execution of automatic programming or automati c erasure. in programmer mode, provide a 12- mhz input-clock signal. notes: 1. for the prom programmer and the version of its program, see the instruction manuals for socket adapter. 2. in this lsi, set the programming voltage of the prom programmer to 3.3 v.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 710 of 862 rej09b0429-0100 21.8 serial communication interface specification for boot mode initiating boot mode enables the boot program to communicate with the host by using the internal sci. the serial communication inte rface specification is shown below. (1) status the boot program has three states. 1. bit-rate-adjustment state in this state, the boot program adjusts the bit rate to communicate with the host. initiating boot mode enables starting of the boot program and entry to the bit-rate-adjustment state. the program receives the command from the host to ad just the bit rate. after adjusting the bit rate, the program enters the inquiry/selection state. 2. inquiry/selection state in this state, the boot program responds to inquiry commands from the host. the device name, clock mode, and bit rate are selected. after sel ection of these settings, the program is made to enter the programming/erasing state by the command for a transition to the programming/erasing state. the program transfers the libraries required for erasure to the on- chip ram and erases the user mats and user boot mats before the transition. 3. programming/erasing state programming and erasure by the boot program take place in this state. the boot program is made to transfer the programming/erasing programs to the ram by commands from the host. sum checks and blank checks are executed by sending these comm ands from the host. these boot program states are shown in figure 21.18.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 711 of 862 rej09b0429-0100 transition to programming/erasing programming/erasing wait checking inquiry response erasing programming reset bit-rate-adjustment state operations for erasing user mats and user boot mats operations for inquiry and selection operations for programming operations for checking operations for erasing operations for response inquiry/response wait figure 21.18 boot program states
section 21 flash memory rev. 1.00 mar. 17, 2008 page 712 of 862 rej09b0429-0100 (2) bit-rate-adjustment state the bit rate is calculated by measuring the period of transfer of a low-leve l byte (h'00) from the host. the bit rate can be changed by the command for a new bit rate selection. after the bit rate has been adjusted, the boot program enters the inquiry and selection state. the bit-rate-adjustment sequence is shown in figure 21.19. host boot program h'00 (30 times maximum) h'e6 (boot response) measuring the 1-bit length h'00 (completion of adjustment) h'55 (h'ff (error)) figure 21.19 bit-rate-adjustment sequence (3) communications protocol after adjustment of the bit rate, the protocol for communications between the host and the boot program is as shown below. 1. 1-byte commands and 1-byte responses these commands and responses are comprised of a single byte. these are consists of the inquiries and the ack for successful completion. 2. n-byte commands or n-byte responses these commands and responses are comprised of n bytes of data. these are selections and responses to inquiries. the amount of programming data is not included under this heading because it is determined in another command. 3. error response the error response is a response to inquiries. it consists of an error response and an error code and comes two bytes.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 713 of 862 rej09b0429-0100 4. programming of 128 bytes the size is not specified in commands. the size of n is in dicated in response to the programming unit inquiry. 5. memory read response this response consists of 4 bytes of data. command or response size data checksum error response error code command or response error response n-byte command or n-byte response 1-byte command or 1-byte response address command data (n bytes) checksum 128-byte programming size response data checksum memory read response figure 21.20 communication protocol format ? command (1 byte): commands including inquiries, selection, programming, erasing, and checking ? response (1 byte): response to an inquiry ? size (1 byte): the amount of data for transmission excluding the command, amount of data, and checksum ? checksum (1 byte): the checksum is calculated so that the total of all values from the command byte to the sum byte becomes h 00. ? data (n bytes): detailed data of a command or response ? error response (1 byte): error response to a command ? error code (1 byte): type of the error ? address (4 bytes): address for programming ? data (n bytes): data to be programmed (the size is indicated in the response to the programming unit inquiry.)
section 21 flash memory rev. 1.00 mar. 17, 2008 page 714 of 862 rej09b0429-0100 ? size (4 bytes): 4-byte re sponse to a memory read (4) inquiry and selection states the boot program returns information from the flash memory in response to the host?s inquiry commands and sets the device code, clock mode, and bit rate in response to the host?s selection command. inquiry and selection commands are listed below. table 21.11 inquiry and selection commands command command name description h'20 supported device inquiry inquiry regarding device codes h'10 device selection sele ction of device code h'21 clock mode inquiry inquiry regarding numbers of clock modes and values of each mode h'11 clock mode selection indication of the selected clock mode h'22 multiplication ratio inquiry i nquiry regarding the number of frequency- multiplied clock types, the number of multiplication ratios, and the values of each multiple h'23 operating clock frequency inquiry i nquiry regarding the maximum and minimum values of the main clock and peripheral clocks h'24 user boot mat information inquiry i nquiry regarding the number of user boot mats and the start and last addresses of each mat h'25 user mat information inquiry inquiry regarding the a number of user mats and the start and last addresses of each mat h'26 block for erasing information inquiry inquiry regarding the number of blocks and the start and last addresses of each block h'27 programming unit inquiry inquiry regarding the unit of programming data h'3f new bit rate selection selection of new bit rate h'40 transition to programming/erasing state erasing of user mat and user boot mat, and entry to programming/erasing state h'4f boot program status inquiry inquiry into the oper ated status of the boot program
section 21 flash memory rev. 1.00 mar. 17, 2008 page 715 of 862 rej09b0429-0100 the selection commands, which are device selection (h'10), clock mode selection (h'11), and new bit rate selection (h'3f), should be sent from the host in that order. these commands will certainly be needed. when two or more selection commands are sent at once, the last command will be valid. all of these commands, except for the boot program status inquiry command (h'4f), will be valid until the boot program receives th e programming/erasing transition (h'40). the host can choose the needed commands out of the commands and inquiries listed above. the boot program status inquiry command (h'4f) is valid after the boot program has received the programming/erasing transition command (h'40). (a) supported device inquiry the boot program will return the device codes of supported devices and the product code in response to the supported device inquiry. command h'20 ? command, h'20, (1 byte): inquiry regarding supported devices response h'30 size number of devices number of characters device code product name sum ? response, h'30, (1 byte): response to the supported device inquiry ? size (1 byte): number of bytes to be tran smitted, excluding the command, size, and checksum, that is, the amount of data contribu tes by the number of devices, characters, device codes and product names ? number of devices (1 byte): the number of device types supported by the boot program ? number of characters (1 byte ): the number of characters in the device codes and boot program?s name ? device code (4 bytes): ascii code of the supporting product ? product name (n bytes): type name of the boot program in ascii-coded characters ? sum (1 byte): checksum the checksum is calculated so that the total number of all values from the command byte to the sum byte becomes h'00.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 716 of 862 rej09b0429-0100 (b) device selection the boot program will set the supported device to the specified device code. the program will return the selected device code in response to the inquiry after this setting has been made. command h'10 size device code sum ? command, h'10, (1 byte): device selection ? size (1 byte): amount of device-code data this is fixed at 2 ? device code (4 bytes): device code (ascii code) returned in response to the supported device inquiry ? sum (1 byte): checksum response h'06 ? response, h'06, (1 byte): response to the device selection command ack will be returned when the device code matches. error response h'90 error ? error response, h'90, (1 byte): error response to the device selection command error : (1 byte): error code h'11: sum check error h'21: device code error, that is, the device code does not match (c) clock mode inquiry the boot program will return the supported clock modes in response to the clock mode inquiry. command h'21 ? command, h'21, (1 byte): inquiry regarding clock mode response h'31 size number of modes mode sum ? response, h'31, (1 byte): response to the clock-mode inquiry ? size (1 byte): amount of data that represents the number of modes and modes ? number of clock modes (1 byte): the number of supported clock modes h'00 indicates no clock mode or the device allows to read the clock mode. ? mode (1 byte): values of the supported clock modes (i.e. h'01 means clock mode 1.) ? sum (1 byte): checksum
section 21 flash memory rev. 1.00 mar. 17, 2008 page 717 of 862 rej09b0429-0100 (d) clock mode selection the boot program will set the sp ecified clock mode. the program will return the selected clock- mode information after this setting has been made. the clock-mode selection command should be sent after the device-selection commands. command h'11 size mode sum ? command, h'11, (1 byte): selection of clock mode ? size (1 byte): amount of data that represents the modes ? mode (1 byte): a clock mode returned in reply to the supported clock mode inquiry. ? sum (1 byte): checksum response h'06 ? response, h'06, (1 byte): response to the clock mode selection command ack will be returned when the clock mode matches. error response h'91 error ? error response, h'91, (1 byte) : error response to the clock mode selection command ? error : (1 byte): error code h'11: checksum error h'22: clock mode error, that is, the clock mode does not match. even if the clock mode numbers are h'00 and h'01 by a clock mode inquiry, the clock mode must be selected using these respective values.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 718 of 862 rej09b0429-0100 (e) multiplication ratio inquiry the boot program will return the supported multiplication and division ratios. command h'22 ? command, h'22, (1 byte): inquiry regarding multiplication ratio response h'32 size number of types number of multiplication ratios multiplica- tion ratio sum ? response, h'32, (1 byte): response to the multiplication ratio inquiry ? size (1 byte): the amount of da ta that represents the nu mber of clock sources and multiplication ratios and the multiplication ratios ? number of types (1 byte): the number of supported multiplied clock types (e.g. when there are two multiplied clock types, which are the main and peripheral clocks, the number of types will be h'02.) ? number of multiplication ratios (1 byte): the number of multiplication ratios for each type (e.g. the number of multiplication ratios to which the main clock can be set and the peripheral clock can be set.) ? multiplication ratio (1 byte) multiplication ratio: the value of the multiplication ratio (e.g. when the clock-frequency multiplier is four, the value of multiplication ratio will be h'04.) division ratio: the inverse of the division ratio, i.e. a negative number (e.g. when the clock is divided by two, the value of division ratio will be h'fe. h'fe = d'-2) the number of multiplication ratios returned is the same as the number of multiplication ratios and as many groups of data ar e returned as there are types. ? sum (1 byte): checksum
section 21 flash memory rev. 1.00 mar. 17, 2008 page 719 of 862 rej09b0429-0100 (f) operating clock frequency inquiry the boot program will return the number of operating clock frequencies, and the maximum and minimum values. command h'23 ? command, h'23, (1 byte): inquiry regarding operating clock frequencies response h'33 size number of operating clock frequencies minimum value of operating clock frequency maximum value of operating clock frequency sum ? response, h'33, (1 byte): response to operating clock frequency inquiry ? size (1 byte): the number of bytes that represents the mi nimum values, maximum values, and the number of frequencies. ? number of operating clock frequencies (1 byte): the number of supported operating clock frequency types (e.g. when there are two operating clock frequen cy types, which are the main and peripheral clocks, the number of types will be h'02.) ? minimum value of operating clock frequency (2 bytes): the minimum value of the multiplied or divided clock frequency. the minimum and maximum values represent the values in mhz, valid to the hundredths place of mhz, and multiplied by 100. (e.g. when the value is 20.00 mhz, it will be 2000, which is h'07d0.) ? maximum value (2 bytes): maximum value among the multiplied or divided clock frequencies. there are as many pairs of minimum and maximum values as there are operating clock frequencies. ? sum (1 byte): checksum
section 21 flash memory rev. 1.00 mar. 17, 2008 page 720 of 862 rej09b0429-0100 (g) user boot mat information inquiry the boot program will return the number of user boot mats and their addresses. command h'24 ? command, h'24, (1 byte): inquiry regarding user boot mat information response h'34 size number of areas area-start address area-last address sum ? response, h'34, (1 byte): response to user boot mat information inquiry ? size (1 byte): the nu mber of bytes that repr esents the number of ar eas, area-start addresses, and area-last address ? number of areas (1 byte): the number of consecutive user boot mat areas when user boot mat areas are consecutive, the number of areas returned is h'01. ? area-start address (4 byte): start address of the area ? area-last address (4 byte): last address of the area there are as many groups of data representing the start and last addre sses as there are areas. ? sum (1 byte): checksum (h) user mat information inquiry the boot program will return the number of user mats and their addresses. command h'25 ? command, h'25, (1 byte): inquiry regarding user mat information response h'35 size number of areas start address area last address area sum ? response, h'35, (1 byte): response to the user mat information inquiry ? size (1 byte): the nu mber of bytes that repr esents the number of ar eas, area-start address and area-last address ? number of areas (1 byte): the numb er of consecutive user mat areas when the user mat areas are consecutive, the number of areas is h'01. ? area-start address (4 bytes) : start addres s of the area
section 21 flash memory rev. 1.00 mar. 17, 2008 page 721 of 862 rej09b0429-0100 ? area-last address (4 bytes) : last address of the area there are as many groups of data representing the start and last addre sses as there are areas. ? sum (1 byte): checksum (i) erased block information inquiry the boot program will return the number of erased blocks and their addresses. command h'26 ? command, h'26, (1 byte): inquiry regarding erased block information response h'36 size number of blocks block start address block last address sum ? response, h'36, (1 byte): response to the number of erased blocks and addresses ? size (three bytes): the number of bytes that represents the number of blocks, block-start addresses, and block-last addresses. ? number of blocks (1 byte): the number of erased blocks ? block start address (4 bytes): start address of a block ? block last address (4 bytes): last address of a block there are as many groups of data representing the start and last addre sses as there are areas. ? sum (1 byte): checksum (j) programming unit inquiry the boot program will return the programming unit used to program data. command h'27 ? command, h'27, (1 byte): inquiry regarding programming unit response h'37 size programming unit sum ? response, h'37, (1 byte): response to programming unit inquiry ? size (1 byte): the number of bytes that indicate the programming unit, which is fixed to 2 ? programming unit (2 bytes): a unit for programming this is the unit for reception of programming. ? sum (1 byte): checksum
section 21 flash memory rev. 1.00 mar. 17, 2008 page 722 of 862 rej09b0429-0100 (k) new bit-rate selection the boot program will set a new bit rate and return the new bit rate. this selection should be sent after sending the clock mode selection command. command h'3f size bit rate input frequency number of multiplication ratios multiplication ratio 1 multiplication ratio 2 sum ? command, h'3f, (1 byte): selection of new bit rate ? size (1 byte): the number of byt es that represents the bit rate, input frequency, number of multiplication ratios, and multiplication ratio ? bit rate (2 bytes): new bit rate one hundredth of the value (e.g. when the value is 19200 bps, it will be 192, which is h 00c0.) ? input frequency (2 bytes): frequency of the clock input to the boot program this is valid to the hundredths place and represen ts the value in mhz mul tiplied by 100. (e.g. when the value is 20.00 mhz, it will be 2000, which is h'07d0.) ? number of multiplication ratios (1 byte): the number of multiplication ratios to which the device can be set. ? multiplication ratio 1 (1 byte) : the value of multiplication or division ratios for the main operating frequency multiplication ratio (1 byte): the value of the multiplication ratio (e.g. when the clock frequency is multiplied by four, the multiplication ratio will be h'04.) division ratio: the inverse of the division ratio, as a negative number (e.g. when the clock frequency is divided by two, the value of division ratio will be h'fe. h'fe = d'-2) ? multiplication ratio 2 (1 byte): the value of multiplication or division ratios for the peripheral frequency multiplication ratio (1 byte): the value of the multiplication ratio (e.g. when the clock frequency is multiplied by four, the multiplication ratio will be h'04.) (division ratio: the inverse of the division ratio, as a negative number (e.g. when the clock is divided by two, the value of division ratio will be h'fe. h'fe = d'-2) ? sum (1 byte): checksum response h'06 ? response, h'06, (1 byte): response to selection of a new bit rate when it is possible to set the bit rate, the response will be ack.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 723 of 862 rej09b0429-0100 error response h'bf error ? error response, h'bf, (1 byte): error response to selection of new bit rate ? error: (1 byte): error code h'11: sum checking error h'24: bit-rate selection error the rate is not available. h'25: error in input frequency this input frequency is not within the specified range. h'26: multiplication-ratio error the ratio does not match an available ratio. h'27: operating frequency error the frequency is not within the specified range. (5) received data check the methods for checking of r eceived data are listed below. 1. input frequency the received value of the input fr equency is checked to ensure th at it is within the range of minimum to maximum frequencies which matches the clock modes of the specified device. when the value is out of this range, an input-frequency error is generated. 2. multiplication ratio the received value of the multiplica tion ratio or division ratio is ch ecked to ensure that it matches the clock modes of the specified device. when the value is out of this range, an multiplication- ratio error is generated. 3. operating frequency operating frequency is calculated from the r eceived value of the input frequency and the multiplication or division ratio. the input frequency is input to the lsi and the lsi is operated at the operating frequency. the expression is given below. operating frequency = input frequency multiplication ratio, or operating frequency = input frequency division ratio the calculated operating frequency should be checked to ensure that it is within the range of minimum to maximum frequencies which are available with the clock modes of the specified device. when it is out of this range, an operating frequency error is generated.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 724 of 862 rej09b0429-0100 4. bit rate to facilitate error checking, the value (n) of clock select (cks) in the serial mode register (smr), and the value (n) in the bit rate register (brr), which are found from the peripheral operating clock frequency ( ) and bit rate (b), are used to calculate the error rate to ensure that it is less than 4%. if the error is more than 4%, a bit rate erro r is generated. the error is calculated using the following expression: error (%) = {[ ] ? 1} 100 (n + 1) b 64 2 (2 n ? 1) 10 6 when the new bit rate is selectable, the rate will be set in the register after sending ack in response. the host will send an ack with the new bit rate for confirmation and the boot program will response with that rate. confirmation h'06 ? confirmation, h'06, (1 byte): confirmation of a new bit rate response h'06 ? response, h'06, (1 byte): response to confirmation of a new bit rate the sequence of new bit-rate selection is shown in figure 21.21. host boot program setting a new bit rate h'06 (ack) waiting for one-bit period at the specified bit rate h'06 (ack) with the new bit rate h'06 (ack) with the new bit rate setting a new bit rate setting a new bit rate figure 21.21 new bit- rate selection sequence
section 21 flash memory rev. 1.00 mar. 17, 2008 page 725 of 862 rej09b0429-0100 (6) transition to programming/erasing state the boot program will transfer the erasing program, and erase the user mats and user boot mats in that order. on completion of this erasure, ack will be returned and will enter the programming/erasing state. the host should select the device code, clock mode, and new bit rate with device selection, clock- mode selection, and new bit-rate selection commands, and then send the command for the transition to programming/erasing st ate. these procedures should be carried out before sending of the programming selection command or program data. command h'40 ? command, h'40, (1 byte): transitio n to programming/erasing state response h'06 ? response, h'06, (1 byte): response to transition to programming/erasing state the boot program will send ack when the user mat and user boot mat have been erased by the transferred erasing program. error response h'c0 h'51 ? error response, h'c0, (1 byte): error response for user boot mat blank check ? error code, h'51, (1 byte): erasing error an error occurred and er asure was not completed. (7) command error a command error will occur when a command is un defined, the order of commands is incorrect, or a command is unacceptable. issuing a clock-mo de selection command be fore a device selection or an inquiry command after the transition to programming/erasing state command, are examples. error response h'80 h'xx ? error response, h'80, (1 byte): command error ? command, h'xx, (1 byte): received command
section 21 flash memory rev. 1.00 mar. 17, 2008 page 726 of 862 rej09b0429-0100 (8) command order the order for commands in the inquir y selection state is shown below. 1. a supported device inquiry (h'20) should be made to inquire about the supported devices. 2. the device should be selected from among those described by the returned information and set with a device-selection (h'10) command. 3. a clock-mode inquiry (h'21) should be made to inquire about the supported clock modes. 4. the clock mode should be selected from among those described by the returned information and set. 5. after selection of the device and clock mode, inquiries for other required information should be made, such as the multiplication-ratio inquiry (h'22) or operating frequency inquiry (h'23), which are needed for a new bit-rate selection. 6. a new bit rate should be selected with the new bit-rate selection (h'3f) command, according to the returned information on multiplication ratios and operating frequencies. 7. after selection of the device and clock mode, the information of the user boot mat and user mat should be made to inquire about the user boot mats information inquiry (h'24), user mats information inquiry (h'25), erased block information inquiry (h'26), and programming unit inquiry (h'27). 8. after making inquiries and selecting a new bit rate, issue the transition to programming/erasing state command (h'40) . the boot program will then enter the programming/erasing state.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 727 of 862 rej09b0429-0100 (9) programming/erasing state a programming selection command makes the boot program select the programming method, a 128-byte programming command makes it program the memory with data, and an erasing selection command and block erasing command make it erase the block. the programming/erasing commands are listed below. table 21.12 programming/erasing command command command name description h'42 user boot mat programming selection t ransfers the user boot mat programming program h'43 user mat programming selection transfers the user mat programming program h'50 128-byte programming programs 128 bytes of data h'48 erasing selection trans fers the erasing program h'58 block erasing erases a block of data h'52 memory read reads the contents of memory h'4a user boot mat sum check checks the checksum of the user boot mat h'4b user mat sum check checks the checksum of the user mat h'4c user boot mat blank check che cks whether the cont ents of the user boot mat are blank h'4d user mat blank check checks whether the content s of the user mat are blank h'4f boot program status inquiry i nquires into the boot program?s status
section 21 flash memory rev. 1.00 mar. 17, 2008 page 728 of 862 rej09b0429-0100 ? programming programming is executed by a programming-selection command and a 128-byte programming command. firstly, the host should send the programming-selection command and select the programming method and programming mats. there are two programming selection commands, and selection is according to the ar ea and method for programming. 1. user boot mat programming selection 2. user mat programming selection after issuing the programming selection command, the host should send the 128-byte programming command. the 128-byte programming command that follows the selection command represents the data pr ogrammed according to the meth od specified by the selection command. when more than 128-byte data is programmed, 128-byte commands should repeatedly be executed. sending a 128-byte programming command with h'ffffffff as the address will stop the programming. on completion of programming, the boot program will wait for selection of programming or erasing. where the sequence of programming operations th at is executed includes programming with another method or of another mat, the procedure must be repeated from the programming selection command. the sequence for programming-selection and 128-byte programming commands is shown in figure 21.22. transfer of the programming program host boot program programming selection (h'42, h'43) ack programming 128-byte programming (address, data) ack 128-byte programming (h'ffffffff) ack repeat figure 21.22 programming sequence
section 21 flash memory rev. 1.00 mar. 17, 2008 page 729 of 862 rej09b0429-0100 (a) user boot mat programming selection the boot program will transfer a programming program. the data is programmed to the user boot mats by the transferred programming program. command h'42 ? command, h'42, (1 byte): user boot mat programming selection response h'06 ? response, h'06, (1 byte): response to user boot mat programming selection when the programming program has been transferred, the boot program will return ack. error response h'c2 error ? error response : h'c2 (1 byte): error response to user boot mat programming selection ? error : (1 byte): error code h'54: selection processing error (transfer error occurs and processing is not completed) ? user mat programming selection the boot program will transfer a program for programming. the data is programmed to the user mats by the transferred program for programming. command h'43 ? command, h'43, (1 byte): user mat programming selection response h'06 ? response, h'06, (1 byte): response to user mat programming selection when the programming program has been transferred, the boot program will return ack. error response h'c3 error ? error response : h'c3 (1 byte): error response to user mat programming selection ? error : (1 byte): error code h'54: selection processing error (transfer error occurs and processing is not completed) (b) 128-byte programming the boot program will use the programming program transferred by the programming selection to program the user boot mats or user mats in response to 128-byte programming. command h'50 address data sum
section 21 flash memory rev. 1.00 mar. 17, 2008 page 730 of 862 rej09b0429-0100 ? command, h'50, (1 byte): 128-byte programming ? programming address (4 bytes): start address for programming multiple of the size specified in response to the programming unit inquiry (i.e. h'00, h'01, h'00, h'00 : h'010000) ? programming data (128 bytes): data to be programmed the size is specified in the response to the programming unit inquiry. ? sum (1 byte): checksum response h'06 ? response, h'06, (1 byte): response to 128-byte programming on completion of programming, the boot program will return ack. error response h'd0 error ? error response, h'd0, (1 byte): error response for 128-byte programming ? error: (1 byte): error code h'11: checksum error h'2a: address error h'53: programming error a programming error has occurred and programming cannot be continued. the specified address s hould match the unit for programming of data. for example, when the programming is in 128-byte units, the lower 8 b its of the address should be h'00 or h'80. when there are less than 128 bytes of data to be programmed, the host should fill the rest with h'ff. sending the 128-byte programming command with the address of h'ffffffff will stop the programming operation. the boot program will interpret this as the end of the programming and wait for selection of programming or erasing. command h'50 address sum ? command, h'50, (1 byte): 128-byte programming ? programming address (4 bytes): end code is h'ff, h'ff, h'ff, h'ff. ? sum (1 byte): checksum response h'06 ? response, h'06, (1 byte): response to 128-byte programming on completion of programming, the boot program will return ack.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 731 of 862 rej09b0429-0100 error response h'd0 error ? error response, h'd0, (1 byte): error response for 128-byte programming ? error: (1 byte): error code h'11: checksum error h'2a: address error h'53: programming error an error has occurred in programming and programming cannot be continued. (10) erasure erasure is performed with the erasure selection and block erasure command. firstly, erasure is selected by th e erasure selection command and th e boot program then erases the specified block. the command should be repeatedly executed if two or more blocks are to be erased. sending a block-erasure command from the ho st with the block number h'ff will stop the erasure operating. on completion of erasing, the boot program will wait for selection of programming or erasing. the sequences of issuing the erasure selection command and block-erasure command are shown in figure 21.23. transfer of erasure program host boot program preparation for erasure (h'48) ack erasure erasure (erasure block number) erasure (h'ff) ack ack repeat figure 21.23 erasure sequence
section 21 flash memory rev. 1.00 mar. 17, 2008 page 732 of 862 rej09b0429-0100 (a) erasure selection the boot program will transfer th e erasure program. user mat data is erased by the transferred erasure program. command h'48 ? command, h'48, (1 byte): erasure selection response h'06 ? response, h'06, (1 byte): response for erasure selection after the erasure program has been transferred, the boot program will return ack. error response h'c8 error ? error response, h'c8, (1 byte): erro r response to erasure selection ? error: (1 byte): error code h'54: selection processing error (transfer error occurs and processing is not completed) (b) block erasure the boot program will erase the contents of the specified block. command h'58 size block number sum ? command, h'58, (1 byte): erasure ? size (1 byte): the nu mber of bytes that represen ts the erasure block number this is fixed to 1. ? block number (1 byte): number of the block to be erased ? sum (1 byte): checksum response h'06 ? response, h'06, (1 byte): response to erasure after erasure has been completed, the boot program will return ack. error response h'd8 error ? error response, h'd8, (1 byte): response to erasure ? error (1 byte): error code h'11: sum check error h'29: block number error block number is incorrect. h'51: erasure error an error has occurred during erasure.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 733 of 862 rej09b0429-0100 on receiving block number h'ff, the boot program will stop er asure and wait for a selection command. command h'58 size block number sum ? command, h'58, (1 byte): erasure ? size, (1 byte): the number of byte s that represents the block number this is fixed to 1. ? block number (1 byte): h'ff stop code for erasure ? sum (1 byte): checksum response h'06 ? response, h'06, (1 byte): response to end of erasure (ack) when erasure is to be performed after the block number h'ff has been sent, the procedure should be executed from the erasure selection command. (11) memory read the boot program will return the data in the specified address. command h'52 size area read address read size sum ? command: h'52 (1 byte): memory read ? size (1 byte): amount of data that represents th e area, read address, and read size (fixed at 9) ? area (1 byte) h'00: user boot mat h'01: user mat an address error occurs when the area setting is incorrect. ? read address (4 bytes): star t address to be read from ? read size (4 bytes): size of data to be read ? sum (1 byte): checksum response h'52 read size data sum ? response: h'52 (1 byte): response to memory read ? read size (4 bytes): size of data to be read ? data (n bytes): data for the read size from the read address ? sum (1 byte): checksum
section 21 flash memory rev. 1.00 mar. 17, 2008 page 734 of 862 rej09b0429-0100 error response h'd2 error ? error response: h'd2 (1 byte): error response to memory read ? error: (1 byte): error code h'11: sum check error h'2a: address error the read address is not in the mat. h'2b: size error the read size exceeds the mat. (12) user boot mat sum check the boot program will return the byte-by-byte total of the contents of the bytes of the user boot mat, as a 4-byte value. command h'4a ? command, h'4a, (1 byte): su m check for user-boot mat response h'5a size checksum of user boot program sum ? response, h'5a, (1 byte): response to the sum check of user-boot mat ? size (1 byte): the number of bytes that repr esents the checksum this is fixed to 4. ? checksum of user boot program (4 bytes): checksum of user boot mats the total of the data is obtained in byte units. ? sum (1 byte): sum check for data being transmitted (13) user mat sum check the boot program will return the byte-by-byte total of the contents of the bytes of the user mat. command h'4b ? command, h'4b, (1 byte): sum check for user mat response h'5b size checksum of user program sum ? response, h'5b, (1 byte): response to the sum check of the user mat ? size (1 byte): the number of bytes that repr esents the checksum this is fixed to 4. ? checksum of user boot program (4 bytes): checksum of user mats the total of the data is obtained in byte units. ? sum (1 byte): sum check for data being transmitted
section 21 flash memory rev. 1.00 mar. 17, 2008 page 735 of 862 rej09b0429-0100 (14) user boot mat blank check the boot program will check whether or not all user boot mats are blank and return the result. command h'4c ? command, h'4c, (1 byte): blank check for user boot mat response h'06 ? response, h'06, (1 byte): response to the blank check of user boot mat if all user mats are blank (h'ff), th e boot program will return ack. error response h'cc h'52 ? error response, h'cc, (1 byte): response to blank check for user boot mat ? error code, h'52, (1 byte): erasure has not been completed. (15) user mat blank check the boot program will check whether or not al l user mats are blank and return the result. command h'4d ? command, h'4d, (1 byte): bl ank check for user mats response h'06 ? response, h'06, (1 byte): response to the blank check for user boot mats if the contents of all user mats are blank (h'ff), the boot program will return ack. error response h'cd h'52 ? error response, h'cd, (1 byte): error response to the blank check of user mats. ? error code, h'52, (1 byte): erasure has not been completed.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 736 of 862 rej09b0429-0100 (16) boot program state inquiry the boot program will return indications of its present state and error condition. this inquiry can be made in the inquiry/selection stat e or the programming/erasing state. command h'4f ? command, h'4f, (1 byte): inquiry regarding boot program?s state response h'5f size status error sum ? response, h'5f, (1 byte): response to boot program state inquiry ? size (1 byte): the numb er of bytes. this is fixed to 2. ? status (1 byte): state of the boot program ? error (1 byte): error status error = 0 indicates normal operation. error = 1 indicates error has occurred. ? sum (1 byte): sum check table 21.13 status code code description h'11 device selection wait h'12 clock mode selection wait h'13 bit rate selection wait h'1f programming/erasing stat e transition wait (bit rate selection is completed) h'31 programming state for erasure h'3f programming/erasing selection wait (erasure is completed) h'4f programming data receive wa it (programming is completed) h'5f erasure block specification wait (erasure is completed)
section 21 flash memory rev. 1.00 mar. 17, 2008 page 737 of 862 rej09b0429-0100 table 21.14 error code code description h'00 no error h'11 sum check error h'12 program size error h'21 device code mismatch error h'22 clock mode mismatch error h'24 bit rate selection error h'25 input frequency error h'26 multiplication ratio error h'27 operating frequency error h'29 block number error h'2a address error h'2b data length error h'51 erasure error h'52 erasure incomplete error h'53 programming error h'54 selection processing error h'80 command error h'ff bit-rate-adjustment confirmation error
section 21 flash memory rev. 1.00 mar. 17, 2008 page 738 of 862 rej09b0429-0100 21.9 usage notes 1. the initial state of the product at its shipment is in the erased state. for the product whose revision of erasing is undefined, we recommend to execute automatic er asure for checking the initial state (erased state) and compensating. 2. for the prom programmer suitable for programme r mode in this lsi and its program version, refer to the instruction manu al of the socket adapter. 3. if the socket, socket adapter, or product index does not match the specifications, too much current flows and the product may be damaged. 4. if a voltage higher than the rated voltage is applied, the product may be fatally damaged. use a prom programmer that supports the 512-kbyte flash memory on-chip mcu device at 3.3 v. do not set the programmer to hn28f101 or the programming voltage to 5.0 v. use only the specified socket adapter. if other adapters are used, the product may be damaged. 5. do not remove the chip from the prom programmer nor input a reset signal during programming/erasing. as a high voltage is applied to the flash memory during programming/erasing, doing so may damage or destroy flash memory permanently. if reset is executed accidentally, reset must be releas ed after the reset input period of 100 s which is longer than normal. 6. the flash memory is not accessible until fkey is cleare d after programming/erasing completes. if this lsi is restarted by a reset immediately after programming/erasing has finished, secure the reset period (period of res = 0) of more than 100 s. though transition to the reset state or hardware stan dby state during programming/erasing is prohibited, if reset is executed accidentally, reset must be releas ed after the reset input period of 100 s which is longer than normal. 7. at powering on or off the vcc power supply, fix the res pin to low and set the flash memory to hardware protection state. this power on/off timing must also be satisfied at a power-off and power-on caused by a power failure and other factors. 8. program the area with 128-byte programming-unit blocks in on-board programming or programmer mode only once. perform programming in the state where the programming-unit block is fully erased. 9. when the chip is to be reprogrammed with the programmer after execution of programming or erasure in on-board programming mode, it is recommend that automatic programming is performed after execution of automatic erasure. 10. to write data or programs to the flash memory, data or programs must be allocated to addresses higher than that of the external interrupt vector ta ble (h'000040) and h'ff must be written to the areas that are reserved for the system in the exception handling vector table.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 739 of 862 rej09b0429-0100 11. if data other than h'ffffffff is written to the key code area (h'00003c to h'00003f) of flash memory, only h'00 can be read in programmer mode. (in this case, data is read as h'00. rewrite is possible after erasing the data.) fo r reading in programmer mode, make sure to write h'ffffffff to the entire key code area. if da ta other than h'ff is to be written to the key code area in programmer mode, a verification error will occur unless a software countermeasure is taken for the prom programmer and the version of its program. 12. the programming program that includes the initialization routine and the erasing program that includes the initialization routine are each 3 kbytes or less. accordingly, when the cpu clock frequency is 34 mhz, the download for each program takes approximately 180 s at the maximum. 13. while an instruction in on-chip ram is bein g executed, the dtc can wr ite to the sco bit in fccs that is used for a download request or fmats that is used for mat switching. make sure that these registers are not accidentally written to, otherwise an on-chip program may be downloaded and damage ram or a mat switchover may occur and the cpu get out of control. do not use dtc to program flash related registers. 14. a programming/erasing program for flash memory used in the conventional h8s f-ztat microcomputer which does not support download of the on-chip program by a sco transfer request cannot run in this lsi. be sure to download the on-chip program to execute programming/erasing of flash memory in this lsi. 15. unlike the conventional h8s f-ztat microcom puter, no countermeasures are available for a runaway by wdt during programming/erasing. prepare countermeasures (e.g. use of the periodic timer interrupts) for wdt with taking the programming/erasing time into consideration as required.
section 21 flash memory rev. 1.00 mar. 17, 2008 page 740 of 862 rej09b0429-0100
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 741 of 862 rej09b0429-0100 section 22 boundary scan (jtag) the jtag (joint test action group) is standardized as an international standard, ieee standard 1149.1, and is open to the public as ieee st andard test access port and boundary-scan architecture. although the name of the function is boundary scan and the name of the group who worked on standardization is the jtag, the jtag is commonly used as the name of a boundary scan architecture and a serial interface to access the devices having the architecture. this lsi has a boundary scan function (jtag). using this function along with other lsis facilitates testing a printed-circuit board. 22.1 features ? five test pins (etck, etdi, etdo, etms, and etrst ) ? tap controller ? six instructions bypass mode extest mode sample/preload mode clamp mode highz mode idcode mode (these instructions are test modes corresponding to ieee 1149.1.)
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 742 of 862 rej09b0429-0100 ta p controller etck etms e trst etdo mux sdir decoder sdbpr sdir: [legend] sdbpr: sdbsr: sdidr: instruction register bypass register boundary scan register id code register etdi sdidr sdbsr shift register figure 22.1 jtag block diagram
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 743 of 862 rej09b0429-0100 22.2 input/output pins table 22.1 shows the jtag pin configuration. table 22.1 pin configuration pin name abbreviation i/o function test clock etck input test clock input provides an independent clock supply to the jtag. as the clock input to the etck pin is supplied directly to the jtag, a clock waveform with a duty cycle close to 50% should be input. for details, see section 26, electrical characteristics. if there is no input, the etck pin is fixed to 1 by an internal pull-up. test mode select etms input test mode select input sampled on the rise of the etck pin. the etms pin controls the internal state of the tap controller. if there is no input, the etms pin is fixed to 1 by an internal pull-up. test data input etdi input serial data input performs serial input of instructions and data for jtag registers. etdi is sampled on the rise of the etck pin. if there is no input, the etdi pin is fixed to 1 by an internal pull-up. test data output etdo output serial data output performs serial output of instructions and data from jtag registers. transfer is performed in synchronization with the etck pin. if there is no output, the etdo pin goes to the high- impedance state. test reset etrst input test reset input signal initializes the jtag asynchronously. if there is no input, the etrst pin is fixed to 1 by an internal pull-up.
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 744 of 862 rej09b0429-0100 22.3 register descriptions the jtag has the fo llowing registers. ? instruction register (sdir) ? bypass register (sdbpr) ? boundary scan register (sdbsr) ? id code register (sdidr) instructions can be input to the instruction regist er (sdir) by serial transfer from the test data input pin (etdi). data from sdir can be output via the test data output pin (etdo). the bypass register (sdbpr) is a 1-bit register to which the etdi and etdo pins ar e connected in bypass, clamp, or highz mode. the boundary scan register (sdbsr) is a 337-bit register to which the etdi and etdo pins are connected in samp le/preload or extest mode. the id code register (sdidr) is a 32-bit register; a fixed code can be output via the etdo pin in idcode mode. all registers cannot be accessed directly by the cpu. table 22.2 shows the kinds of serial tran sfer possible with each jtag register. table 22.2 jtag register serial transfer register serial input serial output sdir possible possible sdbpr possible possible sdbsr possible possible sdidr impossible possible
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 745 of 862 rej09b0429-0100 22.3.1 instruction register (sdir) sdir is a 32-bit register. jtag instructions can be transferred to sdir by serial input from the etdi pin. sdir can be initialized when the etrst pin is low or the tap controller is in the test-logic-reset state, but is not initialized by a reset or in standby mode. only 4-bit instructions can be transferred to sd ir. if an instruction exceeding 4 bits is input, the last 4 bits of the serial data will be stored in sdir. bit bit name initial value r/w description 31 30 29 28 ts3 ts2 ts1 ts0 1 1 1 0 r/w r/w r/w r/w test set bits 0000: extest mode 0001: setting prohibited 0010: clamp mode 0011: highz mode 0100: sample/preload mode 0101: setting prohibited : : 1101: setting prohibited 1110: idcode mode (initial value) 1111: bypass mode 27 to 14 ? all 0 r reserved these bits are always read as 0 and cannot be modified. 13 ? 1 r reserved this bit is always read as 1 and cannot be modified. 12 ? 0 r reserved this bit is always read as 0 and cannot be modified. 11 ? 1 r reserved this bit is always read as 1 and cannot be modified. 10 to 1 ? all 0 r reserved these bits are always read as 0 and cannot be modified. 0 ? 1 r reserved this bit is always read as 1 and cannot be modified.
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 746 of 862 rej09b0429-0100 22.3.2 bypass register (sdbpr) sdbpr is a 1-bit shift regist er. in bypass, clamp, or hi ghz mode, sdbpr is connected between the etdi and etdo pins. 22.3.3 boundary scan register (sdbsr) sdbsr is a shift register provided on the pad for controlling the i/o pins of this lsi. using extest mode or sample/preload mode, a boundary scan test conforming to the ieee1149.1 standard can be performed. table 22.3 shows the relationship between the pins of this lsi and the boundary scan register.
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 747 of 862 rej09b0429-0100 table 22.3 corresponden ce between pins and boundary scan register pin no. pin name input/output bit no. pin no. pin name input/output bit no. from etdi input 320 ? ? 10 md0 ? ? ? input 319 ? ? ? 1 vcc ? 11 nmi ? ? input 336 ? ? enable 335 ? ? 2 p45 output 334 12 stby ? ? input 333 ? ? enable 332 ? ? 3 p46 output 331 13 vcl ? ? input 330 input 318 enable 329 ? ? 4 p47 output 328 14 md2 ? ? input 327 input 317 enable 326 enable 316 5 p56 output 325 15 p51 output 315 input 324 input 314 enable 323 enable 313 6 p57 output 322 16 p50 output 312 ? ? input 311 ? ? enable 310 7 vss ? ? 17 p97 output 309 ? ? input 308 ? ? enable 307 8 res ? ? 18 p96 output 306 input 321 input 305 ? ? enable 304 9 md1 ? ? 19 p95 output 303
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 748 of 862 rej09b0429-0100 pin no. pin name input/output bit no. pin no. pin name input/output bit no. input 302 input 272 enable 301 enable 271 20 p94 output 300 30 pc2 output 270 input 299 input 269 enable 298 enable 268 21 p93 output 297 31 pc1 output 267 input 296 input 266 enable 295 enable 265 22 p92 output 294 32 pc0 output 264 input 293 input 263 enable 292 enable 262 23 p91 output 291 33 pa7 output 261 input 290 input 260 enable 289 enable 259 24 p90 output 288 34 pa6 output 258 input 287 input 257 enable 286 enable 256 25 pc7 output 285 35 pa5 output 255 input 284 ? ? enable 283 ? ? 26 pc6 output 282 36 vcc ? ? input 281 input 254 enable 280 enable 253 27 pc5 output 279 37 pa4 output 252 input 278 input 251 enable 277 enable 250 28 pc4 output 276 38 pa3 output 249 input 275 input 248 enable 274 enable 247 29 pc3 output 273 39 pa2 output 246
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 749 of 862 rej09b0429-0100 pin no. pin name input/output bit no. pin no. pin name input/output bit no. input 245 input 218 enable 244 enable 217 40 pa1 output 243 50 p80 output 216 input 242 input 215 enable 241 enable 214 41 pa0 output 240 51 pe7 output 213 ? ? input 212 ? ? enable 211 42 vss ? ? 52 pe6 output 210 input 239 input 209 enable 238 enable 208 43 p87 output 237 53 pe5 output 207 input 236 input 206 enable 235 enable 205 44 p86 output 234 54 pe4 output 204 input 233 input 203 enable 232 enable 202 45 p85 output 231 55 pe3 output 201 input 230 input 200 enable 229 enable 199 46 p84 output 228 56 pe2 output 198 input 227 input 197 enable 226 enable 196 47 p83 output 225 57 pe1 output 195 input 224 input 194 enable 223 enable 193 48 p82 output 222 58 pe0 output 192 input 221 input 191 enable 220 enable 190 49 p81 output 219 59 pd7 output 189
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 750 of 862 rej09b0429-0100 pin no. pin name input/output bit no. pin no. pin name input/output bit no. input 188 input 165 enable 187 ? ? 60 pd6 output 186 70 p72 ? ? input 185 input 164 enable 184 ? ? 61 pd5 output 183 71 p73 ? ? input 182 input 163 enable 181 ? ? 62 pd4 output 180 72 p74 ? ? input 179 input 162 enable 178 ? ? 63 pd3 output 177 73 p75 ? ? input 176 input 161 enable 175 ? ? 64 pd2 output 174 74 p76 ? ? input 173 input 160 enable 172 ? ? 65 pd1 output 171 75 p77 ? ? input 170 ? ? enable 169 ? ? 66 pd0 output 168 76 avcc ? ? ? ? ? ? ? ? ? ? 67 avss ? ? 77 avref ? ? input 167 input 159 ? ? enable 158 68 p70 ? ? 78 p60 output 157 input 166 input 156 ? ? enable 155 69 p71 ? ? 79 p61 output 154
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 751 of 862 rej09b0429-0100 pin no. pin name input/output bit no. pin no. pin name input/output bit no. input 153 ? ? enable 152 ? ? 80 p62 output 151 90 etck ? ? input 150 ? ? enable 149 ? ? 81 p63 output 148 91 etrst ? ? input 147 input 135 enable 146 enable 134 82 p64 output 145 92 pf2 output 133 input 144 input 132 enable 143 enable 131 83 p65 output 142 93 pf1 output 130 input 141 input 129 enable 140 enable 128 84 p66 output 139 94 pf0 output 127 input 138 ? ? enable 137 ? ? 85 p67 output 136 95 vss ? ? ? ? input 126 ? ? enable 125 86 vcc ? ? 96 p27 output 124 ? ? input 123 ? ? enable 122 87 etms ? ? 97 p26 output 121 ? ? input 120 ? ? enable 119 88 etdo ? ? 98 p25 output 118 ? ? input 117 ? ? enable 116 89 etdi ? ? 99 p24 output 115
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 752 of 862 rej09b0429-0100 pin no. pin name input/output bit no. pin no. pin name input/output bit no. input 114 input 84 enable 113 enable 83 100 p23 output 112 110 p11 output 82 input 111 ? ? enable 110 ? ? 101 p22 output 109 111 vss ? ? input 108 input 81 enable 107 enable 80 102 p21 output 106 112 p10 output 79 input 105 input 78 enable 104 enable 77 103 p20 output 103 113 pb7 output 76 input 102 input 75 enable 101 enable 74 104 p17 output 100 114 pb6 output 73 input 99 input 72 enable 98 enable 71 105 p16 output 97 115 pb5 output 70 input 96 input 69 enable 95 enable 68 106 p15 output 94 116 pb4 output 67 input 93 input 66 enable 92 enable 65 107 p14 output 91 117 pb3 output 64 input 90 input 63 enable 89 enable 62 108 p13 output 88 118 pb2 output 61 input 87 input 60 enable 86 enable 59 109 p12 output 85 119 pb1 output 58
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 753 of 862 rej09b0429-0100 pin no. pin name input/output bit no. pin no. pin name input/output bit no. input 57 input 27 enable 56 enable 26 120 pb0 output 55 130 p41 output 25 input 54 input 24 enable 53 enable 23 121 p30 output 52 131 p42 output 22 input 51 input 21 enable 50 enable 20 122 p31 output 49 132 p43 output 19 input 48 input 18 enable 47 enable 17 123 p32 output 46 133 p52 output 16 input 45 input 15 enable 44 enable 14 124 p33 output 43 134 p53 output 13 input 42 input 12 enable 41 ? ? 125 p34 output 40 135 fwe ? ? input 39 input 11 enable 38 enable 10 126 p35 output 37 136 p54 output 9 input 36 input 8 enable 35 enable 7 127 p36 output 34 137 p55 output 6 input 33 input 5 enable 32 enable 4 128 p37 output 31 138 p44 output 3 input 30 ? ? enable 29 ? ? 129 p40 output 28 139 vss ? ?
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 754 of 862 rej09b0429-0100 pin no. pin name input/output bit no. ? ? ? ? 140 nc ? ? input 2 enable 1 141 pf3 output 0 ? ? ? ? 142 reso ? ? ? ? ? ? 143 xtal ? ? ? ? ? ? 144 extal ? ? to etdo 22.3.4 id code register (sdidr) sdidr is a 32-bit register. in idcode mode, sdidr can output a fixed code, h'08039447, from the etdo pin. however, no serial data can be written to sdidr via the etdi pin. 31 28 27 12 11 1 0 0000 1000 0000 0011 1001 0100 0100 011 1 version (4 bits) part number (16 bits) manufacture identify (11 bits) fixed code (1 bit)
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 755 of 862 rej09b0429-0100 22.4 operation 22.4.1 tap controller state transitions figure 22.2 shows the internal states of the tap controller. state transitions basically conform to the ieee1149.1 standard. test-logic-reset capture-dr shift-dr exit1-dr pause-dr exit2-dr update-dr select-dr-scan run-test/idle 1 0 0 0 0 11 1 11 1 0 0 0 1 0 1 1 1 0 capture-ir shift-ir exit1-ir pause-ir exit2-ir update-ir select-ir-scan 0 0 1 0 0 1 0 1 1 10 0 figure 22.2 tap controller state transitions
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 756 of 862 rej09b0429-0100 22.4.2 jtag reset the jtag can be reset in two ways. ? the jtag is reset when the etrst pin is held at 0. ? when etrst = 1, the jtag can be reset by inputting at least five etck clock cycles while etms = 1. 22.5 boundary scan the jtag pins can be placed in the boundary scan mode stipulated by the ieee1149.1 standard by setting a command in sdir. 22.5.1 supported instructions this lsi supports the three essential instructions defined in the ieee1149.1 standard (bypass, sample/preload, and extest) and optional instructions (clamp, highz, and idcode). (1) bypass (instruction code: b'1111) the bypass instruction is an instruction that operates the bypass register. this instruction shortens the shift path to speed up serial data transfer involving other chips on the printed circuit board. while this instruction is being executed, the test circuit has no effect on the system circuits. (2) sample/preload (instr uction code: b'0100) the sample/preload instruction inputs values from this lsi internal circuitry to the boundary scan register, outputs values from the scan path, and loads data onto the scan path. when this instruction is being executed, this lsi' s input pin signals are transmitted directly to the internal circuitry, and internal circuit values are directly output externally from the output pins. this lsi system circuits are not affected by execution of this instruction. in a sample operation, a snapshot of a value to be transferred from an input pin to the internal circuitry, or a value to be transferred from the internal circuitry to an output pin, is latched into the boundary scan register and read from the scan path. snapshot latching does not affect normal operation of this lsi. in a preload operation, an initial value is set in the parallel output latch of the boundary scan register from the scan path prior to the extest instruction. without a preload operation, when the extest instruction was executed an undefined value would be output from the output
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 757 of 862 rej09b0429-0100 pin until completion of the initial scan sequence (transfer to the output latch) (with the extest instruction, the parallel output latch value is constantly output to the output pin). (3) extest (instruction code: b'0000) the extest instruction is provided to test external circuitry when this lsi is mounted on a printed circuit board. when this instruction is executed, output pins are used to output test data (previously set by the sample/preload instruction) from the boundary scan register to the printed circuit board, and input pins are used to latch test results into the boundary scan register from the printed circuit board. if testing is ca rried out by using the extest instruction n times, the nth test data is scanned in when test data (n-1) is scanned out. data loaded into the output pin boundary scan register in the capture-dr state is not used for external circuit testing (it is replaced by a shift operation). (4) clamp (instruction code: b'0010) when the clamp instruction is enabled, the output pin outputs the value of the boundary scan register that has been previously set by the sample/preload instruction. while the clamp instruction is enabled, the stat e of the boundary scan register maintains the previous state regardless of the state of the tap controller. a bypass register is connected between the etdi and etdo pins. the related circuit operates in the same way when the bypass instruction is enabled. (5) highz (instruction code: b'0011) when the highz instruction is enabled, all output pins enter a high-imped ance state. while the highz instruction is enabled, the state of the bo undary scan register maintains the previous state regardless of the state of the tap controller. a bypass register is connected between the etdi and etdo pins. the related circuit operates in the same way when the bypass instruction is enabled.
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 758 of 862 rej09b0429-0100 (6) idcode (instruction code: b'1110) when the idcode instruction is enabled, the value of the id code register is output from the etdo pin with lsb first when the tap controller is in the shift-dr state. while the idcode instruction is being executed, the test ci rcuit does not affect the system circuit. when the tap controller is in the test-logic-reset state, the instruction regi ster is initialized to the idcode instruction. notes: 1. boundary scan mode does not cover power-supply-related pins (vcc, vcl, vss, avcc, avss, and avref). 2. boundary scan mode does not cover clock-related pins (extal, xtal). 3. boundary scan mode does not cove r reset- and standby-related pins ( res , stby , and reso ). 4. boundary scan mode does not cover jt ag-related pins (etck, etdi, etdo, etms, and etrst ). 5. fix the md2 pin high. 6. use the stby pin in high state.
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 759 of 862 rej09b0429-0100 22.6 usage notes 1. a reset must always be executed by driving the etrst pin to 0, regardless of whether or not the jtag is to be activated. the etrst pin must be held low for 20 etck clock cycles. for details, see section 26, electrical characteristics. to activate the jtag after a reset, drive the etrst pin to 1 and specify the etck, etms, and etdi pins to any value. if the jtag is not to be activated, drive the etrst , etck, etms, and etdi pins to 1 or the high-impedance state. these pins are internally pulled up and are noted in standby mode. 2. the following must be considered when the power-on reset signal is applied to the etrst pin. ? the reset signal must be applied at power-on. ? to prevent the lsi system operation from being affected by the etrst pin of the board tester, circuits must be separated . ? alternatively, to prevent the etrst pin of the board tester from being affected by the lsi system reset, circuits must be separated. figure 22.3 shows a design example of the reset signal circuit wherein no reset signal interference occurs. power-on reset circuit board edge pin system reset etrst res etrst this lsi figure 22.3 reset signal circuit without reset signal interference
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 760 of 862 rej09b0429-0100 3. the registers are not initialized in standby mode. if the etrst pin is set to 0 in standby mode, idcode mode will be entered. 4. the frequency of the etck pin must be lower th an that of the system clock. for details, see section 26, electrical characteristics. 5. data input/output in serial data transfer st arts from the lsb. figure 22.4 and 22.5 shows examples of serial data input/output. 6. when data that exceeds the number of bits of the register connected between the etdi and etdo pins is serially transferred, the serial data that exceeds the number of register bits and output from the etdo pin is the same as that input from the etdi pin. 7. if the jtag serial transfer sequence is disrupted, the etrst pin must be reset. transfer should then be retried, regardless of the transfer operation. 8. if a pin with a pull-up function is sampled while its pull-up function is enabled, 1 can be detected at the corresp onding input scan register. in this case, the corresponding enable scan register should be cleared to 0. 9. if a pin with an open-drain function is sampled while its open-drain function is enabled and its corresponding output scan register is 1, 0 can be detected at the corresponding enable scan register. etdi sdir sdir etdo shift register shift register bit 31 bit 31 bit 0 bit 0 sdir serial data input/output sdir is captured into the shift register in capture-ir, and bits 0 to 31 of sdir are output in that order from the etdo pin in shift-ir. data input from the etdi pin is written to sdir in update-ir. . . . . . . . . . . . capture-ir etdi etdo bit 31 bit 31 bit 28 bit 28 . . . update-ir figure 22.4 serial data input/output (1)
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 761 of 862 rej09b0429-0100 sdidr serial data input/output sdidr is captured into the shift register in capture-dr in idcode mode, and bits 0 to 31 of sdidr are output in that order from the etdo pin in shift-dr. data input from the etdi pin is not written to any register in update-dr. etdi sdidr etdo shift register bit 31 bit 31 bit 0 bit 0 . . . . capture-dr figure 22.5 serial data input/output (2)
section 22 boundary scan (jtag) rev. 1.00 mar. 17, 2008 page 762 of 862 rej09b0429-0100
section 23 clock pulse generator rev. 1.00 mar. 17, 2008 page 763 of 862 rej09b0429-0100 section 23 clock pulse generator this lsi incorporates a clock pulse gene rator which generates the system clock ( ), internal clock, bus master clock, and subclock ( sub). the clock pulse generator co nsists of an oscillator, pll multiplier circuit, system clock se lect circuit, medium-speed clock divider, bus master clock select circuit, subclock input circuit, and subclock waveform shaping circuit. figure 23.1 shows a block diagram of the clock pulse generator. wdt_1 count clock /2 to /32 sub extal xtal excl subclock input circuit subclock waveform shaping circuit pll multiplier circuit oscillator system clock to pin internal clock to peripheral modules bus master cloc k to cpu and dtc system clock select circuit medium- speed clock divider bus master clock select circuit figure 23.1 block diagra m of clock pulse generator the bus master clock is selected as either high-speed mode or medium-speed mode by software according to the settings of the sck2 to sck0 b its in the standby control register. use of the medium-speed clock ( /2 to /32) may be limited during cp u operation and when accessing the internal memory of the cpu. the operation speed of the dt c and the external space access cycle are thus stabilized regardless of the setting of medium-speed mode. for details on the standby control register, see section 24.1.1, standby control register (sbycr). the subclock input is controlled by software according to the ex cle bit setting in the low power control register. for details on the low power control register, see section 24.1.2, low-power control register (lpwrcr).
section 23 clock pulse generator rev. 1.00 mar. 17, 2008 page 764 of 862 rej09b0429-0100 23.1 oscillator clock pulses can be supplied either by connecting a crystal resonator or by providing external clock input. 23.1.1 connecting crystal resonator figure 23.2 shows a typical method of connecting a crystal resonator. an appropriate damping resistance r d , given in table 23.1, should be used. an at-cut parallel-resonance crystal resonator should be used. figure 23.3 shows the equivalent circuit of a crystal resonator. a crystal resonator having the characteristics given in table 23.2 should be used. extal xtal r d c l2 c l1 c l1 = c l2 = 10 to 22 pf figure 23.2 typical conn ection to crystal resonator table 23.1 damping resistance values frequency (mhz) 5 8 8.5 r d ( ? ) 300 200 0 xtal c l at-cut parallel-resonance crystal resonato r extal c 0 lr s figure 23.3 equivalent ci rcuit of crystal resonator
section 23 clock pulse generator rev. 1.00 mar. 17, 2008 page 765 of 862 rej09b0429-0100 table 23.2 crystal resonator parameters frequency(mhz) 5 8 8.5 r s (max) ( ? ) 100 80 70 c 0 (max) (pf) 7 7 7 23.1.2 external clock input method figure 23.4 shows a typical method of connectin g an external clock signal. to leave the xtal pin open, incidental capacitance should be 10 pf or less. to input an inverted clock to the xtal pin, the external clock should be tied to high in standby mode. extal xtal external clock input open (a) example of external clock input when xtal pin left open extal xtal external clock input (b) example of external clock input when an inverted clock is input to xtal pin figure 23.4 example of external clock input when a specified clock signal is input to the extal pin, internal clock signal output is determined after the external cloc k output stabilization delay time (t dext ) has passed. as the clock signal output is not determined during the t dext cycle, a reset signal should be set to low to hold it in reset state. for the external clock output stabilization delay time, refer to table 26.5 and figure 26.8 in section 26, el ectrical characteristics.
section 23 clock pulse generator rev. 1.00 mar. 17, 2008 page 766 of 862 rej09b0429-0100 23.2 pll multiplier circuit the pll multiplier circuit generates a clock of 4 times the frequency of its input clock. the frequency range of the multiplied clock is shown in table 23.3. table 23.3 ranges of mu ltiplied clock frequency input clock (mhz) multiplier system clock (mhz) crystal resonator, 5 to 8.5 4 20 to 34 external clock 23.3 medium-speed clock divider the medium-speed clock divider divides the system clock ( ), and generates /2, /4, /8, /16, and /32 clocks. 23.4 bus master clock select circuit the bus master clock select circuit selects a clock to supply the bus master with either the system clock ( ) or medium-speed clock ( /2, /4, /8, /16, or /32) by the sck2 to sck0 bits in sbycr. 23.5 subclock input circuit the subclock input circuit controls subclock input from the excl pin. to use the subclock, a 32.768-khz external clock should be input from the excl pin. at this time, the p96ddr bit in p9ddr should be cleared to 0, and the ex cle bit in lpwrcr should be set to 1. when the subclock is not used, subclock input should not be enabled. 23.6 subclock waveform shaping circuit to remove noise from the subclock input at the excl pin, the subclock is sampled by a divided clock. the sampling frequency is set by the nesel bit in lpwrcr.
section 23 clock pulse generator rev. 1.00 mar. 17, 2008 page 767 of 862 rej09b0429-0100 23.7 clock select circuit the clock select circuit selects the syst em clock that is used in this lsi. a clock generated by the oscillator, to which the extal and xtal pins are input, and multiplied by the pll circuit is selected as a system clock when returning from high-speed mode, medium- speed mode, sleep mode, the reset state, or standby mode.
section 23 clock pulse generator rev. 1.00 mar. 17, 2008 page 768 of 862 rej09b0429-0100 23.8 usage notes 23.8.1 note on resonator since all kinds of characteristics of the resonato r are closely related to the board design by the user, use the example of resonator connection in this document for only reference; be sure to use an resonator that has been sufficiently evaluated by the user. consult with the resonator manufacturer about the resonator circuit ratings which vary depending on the stray capacitances of the resonator and installation circuit. make sure the voltage applied to the oscillation pins do not exceed the maximum rating. 23.8.2 notes on board design when using a crystal resonator, the crystal resona tor and its load capacitors should be placed as close as possible to the extal and xtal pins. ot her signal lines should be routed away from the oscillation circuit to prevent inductive interference with the correct oscillation as shown in figure 23.5. c l2 signal a signal b c l1 this lsi xtal extal prohibited figure 23.5 note on board design of oscillation circuit section 23.8.3 note on operation check this lsi may oscillate at several khz of frequenc y even when a crystal resonator is not connected to the extal and xtal pins or an external clock is not input. use this lsi after confirming that the lsi operates with appropriate frequency.
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 769 of 862 rej09b0429-0100 section 24 power-down modes for operating modes after the reset state is cancelled, this lsi has not only the normal program execution state but also four power-down modes in which power consumption is significantly reduced. in addition, there is also module stop mode in which reduced power consumption can be achieved by individually stopping on-chip peripheral modules. ? medium-speed mode system clock frequency for the cp u operation can be selected as /2, /4, /8, /16,or /32. ? sleep mode the cpu stops but on-chip peripher al modules continue operating. ? software standby mode clock oscillation stops, and the cpu and on-chip peripheral modules stop operating. ? hardware standby mode clock oscillation stops, and the cpu and on-c hip peripheral modules enter reset state. ? module stop mode independently of above operating modes, on-chip peripheral modules that are not used can be stopped individually.
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 770 of 862 rej09b0429-0100 24.1 register descriptions power-down modes are controlled by the follo wing registers. to access sbycr, lpwrcr, mstpcrh, and mstpcrl, the flshe bit in the seri al timer control register (stcr) must be cleared to 0. for details on st cr, see section 3.2.3, serial timer control register (stcr). ? standby control register (sbycr) ? low power control register (lpwrcr) ? module stop control register h (mstpcrh) ? module stop control register l (mstpcrl) ? module stop control register a (mstpcra) ? sub-chip module stop control register bh, bl (submstpbh, submstpbl) 24.1.1 standby control register (sbycr) sbycr controls power-down modes. bit bit name initial value r/w description 7 ssby 0 r/w software standby specifies the operating mode to be entered after executing the sleep instruction. when the sleep instruction is executed in high-speed mode or medium-speed mode: 0: shifts to sleep mode 1: shifts to software standby mode note that the ssby bit is not changed even if a mode transition occurs by an interrupt.
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 771 of 862 rej09b0429-0100 bit bit name initial value r/w description 6 5 4 sts2 sts1 sts0 0 0 0 r/w r/w r/w standby timer select 2 to 0 select the wait time for clo ck settling from clock oscillation start when canceling software standby mode. select a wait time of 8 ms (oscilla tion settling time) or more, depending on the operating frequency. with an external clock, select a wait time of 500 s (external clock output settling delay time) or more, depending on the operating frequency. table 24.1 shows the relationship between the sts2 to sts0 values and wait time. 3 dtspeed 0 r/w dtc speed specifies the operating clock for the bus masters (dtc) other than the cpu in medium-speed mode. 0: all bus masters operate based on the medium-speed clock. 1: the dtc operates based on the system clock. the operating clock is changed when a dtc transfer is requested even if the cp u operates based on the medium-speed clock. 2 1 0 sck2 sck1 sck0 0 0 0 r/w r/w r/w system clock select 2 to 0 select a clock for the bus master in high-speed mode or medium-speed mode. 000: high-speed mode (initial value) 001: medium-speed clock: /2 010: medium-speed clock: /4 011: medium-speed clock: /8 100: medium-speed clock: /16 101: medium-speed clock: /32 11x: must not be set. [legend] x: don't care
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 772 of 862 rej09b0429-0100 table 24.1 operating fr equency and wait time sts2 sts1 sts0 wait time 20mhz 25mhz 34mhz unit 0 0 0 8192 states 0.4 0.3 0.2 0 0 1 16384 states 0.8 0.7 0.5 0 1 0 32768 states 1.6 1.3 1.0 0 1 1 65536 states 3.3 2.6 1.9 1 0 0 131072 states 6.6 5.2 3.9 1 0 1 262144 states 13.1 10.5 7.7 1 1 x reserved * ? ? ? ms recommended specification note: * setting prohibited. [legend] x: don't care 24.1.2 low-power control register (lpwrcr) lpwrcr controls power-down modes. bit bit name initial value r/w description 7, 6 ? 0 r/w reserved the initial value should not be changed. 5 nesel 0 r/w noise elimination sampling frequency select selects the frequency by which the subclock ( sub) input from the excl pin is sampled using the clock ( ) generated by the system clock pulse generator. 0: sampling using /32 clock 1: sampling using /4 clock 4 excle 0 r/w subclock input enable enables/disables subclock input from the excl pin. 0: disables subclock input from the excl pin 1: enables subclock input from the excl pin 3 ? 0 r/w reserved the initial value should not be changed.
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 773 of 862 rej09b0429-0100 bit bit name initial value r/w description 2 pnccs 0 r/w address multiplex chip select controls the output polarity of chip select signals ( cs256 , ios ) in the address multiplex extended mode. 0: outputs cs256 to ios 1: outputs cs256 to ios 1 pncah 0 r/w address multiplex address hold controls the output polarity of the address hold signal ( ah ) in the address multiplex extended mode. 0: outputs ah 1: outputs ah 0 ? 0 r/w reserved the initial value should not be changed.
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 774 of 862 rej09b0429-0100 24.1.3 module stop control registers h, l, and a (mstpcrh, mstpcrl, mstpcra) mstpcr specifies on-chip peripheral modules to shift to module stop mode in module units. each module can enter module stop mode by setting the corresponding bit to 1. ? mstpcrh bit bit name initial value r/w corresponding module 7 mstp15 0 r/w reserved the initial value should not be changed. 6 mstp14 0 r/w data transfer controller (dtc) 5 mstp13 1 r/w 16-bit free-running timer (frt) 4 mstp12 1 r/w 8-bit timers (tmr_0, tmr_1) 3 mstp11 1 r/w 14-bit pwm timer (pwmx) 2 mstp10 1 r/w reserved the initial value should not be changed. 1 mstp9 1 r/w a/d converter 0 mstp8 1 r/w 8-bit timers (tmr_x, tmr_y) ? mstpcrl bit bit name initial value r/w corresponding module 7 mstp7 1 r/w serial communication interface 3 (sci_3) 6 mstp6 1 r/w serial communication interface 1 (sci_1) 5 mstp5 1 r/w reserved the initial value should not be changed. 4 mstp4 1 r/w i 2 c bus interface channel 0 (iic_0) 3 mstp3 1 r/w i 2 c bus interface channel 1 (iic_1) 2 mstp2 1 r/w i 2 c bus interface channel 2, 3 (iic_2, iic_3) 1 mstp1 1 r/w crc operation circuit 0 mstp0 1 r/w i 2 c bus interface channel 4, 5 (iic_4, iic_5)
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 775 of 862 rej09b0429-0100 ? mstpcra bit bit name initial value r/w corresponding module 7 to 3 mstpa7 to mstpa3 all 0 r/w reserved the initial values should not be changed. 2 mstpa2 0 r/w 14-bit pwm timer (pwmx_1) 1 mstpa1 0 r/w 14-bit pwm timer (pwmx_0) 0 mstpa0 0 r/w reserved the initial value should not be changed. mstpcr sets operation and stop by the combination of bits as follows: mstpcrh (bit 3) mstp11 mstpcra (bit 2) mstpa2 function 0 0 14-bit pwm timer (pwmx_1) operates. 0 1 14-bit pwm timer (pwmx_1) stops. 1 x reserved mstpcrh (bit 3) mstp11 mstpcra (bit 1) mstpa1 function 0 0 14-bit pwm timer (pwmx_0) operates. 0 1 14-bit pwm timer (pwmx_0) stops. 1 x reserved note: bit 3 of mstpcrh is the module stop bit for pwmx_0 and pwmx_1. [legend] x: don't care
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 776 of 862 rej09b0429-0100 24.1.4 sub-chip module stop control registers bh, bl (submstpbh, submstpbl) submstpb specifies on-chip peripheral modules to shift to module stop mode in module units. each module can enter module stop mode by setting the corresponding bit to 1. ? submstpbh bit bit name initial value r/w corresponding module 7 to 0 smstpb15 to smstpb8 all 1 r/w reserved the initial values should not be changed. ? submstpbl bit bit name initial value r/w corresponding module 7 to 4 smstpb7 to smstpb4 all 1 r/w reserved the initial values should not be changed. 3 smstpb3 1 r/w serial communicat ion interface with fifo (scif) 2 smstpb2 1 r/w reserved the initial values should not be changed. 1 smstpb1 1 r/w lpc interface (lpc) 0 smstpb0 1 r/w reserved the initial values should not be changed.
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 777 of 862 rej09b0429-0100 24.2 mode transitions and lsi states figure 24.1 shows the enabled mode transition diagram. the mode transition from program execution state to program halt state is performe d by the sleep instruction. the mode transition from program halt state to program execution state is performed by an interrupt. the stby input causes a mode transition from any st ate to hardware standby mode. the res input causes a mode transition from a state other than hardware standby mode to the reset state. table 24.2 shows the lsi internal states in each operating mode. program halt state program execution state sck2 to sck0 are 0 sck2 to sck0 are not 0 sleep instruction sleep instruction external interrupt * any interrupt * stby pin = high res pin = low stby pin = low ssby = 0 ssby = 1, pss = 0 res pin = high : transition after exception handling : power-down mode reset state high-speed mode (main clock) medium-speed mode (main clock) hardware standby mode software standby mode sleep mode (main clock) note: when a transition is made between modes by means of an interrupt, the transition cannot be made on interrupt source generation alone. ensure that interrupt handling is performed after accepting the interrupt request. * nmi, irq0 to irq5 figure 24.1 mode transition diagram
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 778 of 862 rej09b0429-0100 table 24.2 lsi internal states in each mode function high- speed medium- speed sleep module stop software standby hardware standby system clock pulse generator functioning functioning functioning functioning halted halted subclock pulse generator functioning functioning functioning functioning halted halted instruction execution halted halted halted cpu registers functioning functioning in medium-speed mode retained functioning retained undefined nmi external interrupts irq0 to irq15 functioning functioning functioning functioning functioning halted peripheral modules dtc functioning functioning in medium-speed mode/ functioning functioning functioning/ halted (retained) halted (retained) halted (reset) wdt_1 functioning functioning wdt_0 tmr_0,tmr_1 lpc functioning/ halted (retained) frt tmr_x, tmr_y iic_0 to iic_5 crc sci_1, sci_3 scif functioning functioning functioning functioning /halted (retained/ reset) halted (retained/ reset) halted (reset) pwmx_0,pwmx_1 a/d converter functioning/ halted (reset) halted(reset) ram functioning (dtc) functioning retained retained i/o functioning high impedance notes: halted (retained) means that internal regist er values are retained. the internal state is operation suspended. halted (reset) means that internal register values and internal states are initialized. in module stop mode, only modules for wh ich a stop setting has been made are halted (reset or retained).
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 779 of 862 rej09b0429-0100 24.3 medium-speed mode the cpu makes a transition to medium-speed mo de as soon as the current bus cycle ends according to the setting of the sck2 to sck0 b its in sbycr. in medium-speed mode, the cpu operates on the operating clock ( /2, /4, /8, /16, or /32) specified by the sck2 to sck0 bits. the bus masters other than the cpu (dtc) also operate in medium-s peed mode when the dtspeed bit in sbycr is cleared to 0. on-chip peripheral modules other than the bus masters always operate on the system clock ( ). when the dtspeed bit in sbycr is set to 1, the clock can be used as the dtc operating clock. in medium-speed mode, a bus access is executed in the specified numb er of states with respect to the bus master operating clock. for example, if /4 is selected as the operating clock, on-chip memory is accessed in 4 states, and internal i/o regist ers in 8 states. by clearing all of bits sck2 to sck0 to 0, a transition is made to high-speed mode at the end of the current bus cycle. if a sleep instruction is executed when the ssby bit in sbycr is cleared to 0, a transition is made to sleep mode. when sleep mode is cleared by an interrupt, medium-speed mode is restored. when the sleep instruction is executed with the ssby bit set to 1 and the pss bit in tcsr (wdt_1) cleared to 0, operation shifts to software standby mode. when software standby mode is cleared by an external interrupt, medium-speed mode is restored. when the res pin is set low, medium-speed mode is cancelled and operation shifts to the reset state. the same applies in the case of a rese t caused by overflow of the watchdog timer. when the stby pin is driven low, a transition is made to hardware standby mode. figure 24.2 shows an example of medium-speed mode timing.
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 780 of 862 rej09b0429-0100 , bus master clock peripheral module clock internal address bus internal write signal medium-speed mode sbycr sbycr figure 24.2 medium-speed mode timing 24.4 sleep mode the cpu makes a transition to sleep mode if th e sleep instruction is executed when the ssby bit in sbycr is cleared to 0. in sleep mode, cp u operation stops but the peripheral modules do not stop. the contents of the cpu?s internal registers are retained. sleep mode is exited by any interrupt, the res pin, or the stby pin. when an interrupt occurs, sleep mode is exited and interrupt exception handling starts. sleep mode is not exited if the interrupt is disabled, or interrupts other than nmi are masked by the cpu. setting the res pin level low cancels sleep mode and select s the reset state. after the oscillation settling time has passed, driving the res pin high causes the cpu to start reset exception handling. when the stby pin level is driven low, a transition is made to hardware standby mode.
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 781 of 862 rej09b0429-0100 24.5 software standby mode the cpu makes a transition to software standby mode when the sleep instruction is executed with the ssby bit in sbycr set to 1 and the pss bit in tcsr (wdt_1) cleared to 0. in software standby mode, the cpu, on-chip peripheral modules, and clock pulse generator all stop. however, the contents of the cpu registers, on-chip ram data, i/o ports, and the states of on-chip peripheral modules other than the pwmx, a/d converter, and part of the sci are retained as long as the prescribed voltage is supplied. software standby mode is cleared by an external interrupt (nmi, irq0 to irq15 ), the res pin input, or stby pin input. when an external interrupt request signal is in put, system clock oscillation starts, and after the elapse of the time set in bits sts2 to sts0 in sbycr, software standby mode is cleared, and interrupt exception handling is started. when exiting software standby mode by irq0 to irq15 interrupt, set the corresponding enable bit to 1 and ensure that any interrupt with a higher priority than irq0 to irq15 is not generated. software standby mode is not exited if the corresponding enable bit is cleared to 0 or if the interrupt has been masked by the cpu. when the res pin is driven low, system clock oscillation is started. at the same time as system clock oscillation starts, the system clock is supplied to the entire lsi. note that the res pin must be held low until clock oscillation settles. when the res pin goes high after clock oscillation settles, the cpu begins reset exception handling. when the stby pin is driven low, software standby mode is cancelled and a transition is made to hardware standby mode. figure 24.3 shows an example in which a transiti on is made to software standby mode at the falling edge of the nmi pin, and software standby mode is cleared at the rising edge of the nmi pin. in this example, an nmi interr upt is accepted with the nmieg bit in syscr cleared to 0 (falling edge specification), then the nmieg bit is set to 1 (rising edge specification), the ssby bit is set to 1, and a sleep instruction is executed, cau sing a transition to software standby mode. software standby mode is then cleared at the rising edge of the nmi pin.
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 782 of 862 rej09b0429-0100 oscillator nmi nmieg ssby nmi exception handling nmieg = 1 ssby = 1 sleep instruction software standby mode (power-down mode) oscillation stabilization time t osc2 nmi exception handling figure 24.3 software standby mode application example
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 783 of 862 rej09b0429-0100 24.6 hardware standby mode the cpu makes a transition to hardware standby mode from any mode when the stby pin is driven low. in hardware standby mode, all functions enter the rese t state. as long as th e prescribed voltage is supplied, on-chip ram data is retained. the i/ o ports are set to the high-impedance state. in order to retain on-chip ram data, the rame bit in syscr should be cleared to 0 before driving the stby pin low. do not change the state of the mode pins ( md2 , md1, and md0) while this lsi is in hardware standby mode. hardware standby mode is cleared by the stby pin input or the res pin input. when the stby pin is driven high while the res pin is low, clock oscillation is started. ensure that the res pin is held low until system clock oscillation settles. when the res pin is subsequently driven high after the clock oscillation settling time has passed, reset exception handling starts. figure 24.4 shows an example of hardware standby mode timing. oscillator res stby oscillation stabilization time reset exception handling figure 24.4 hardware standby mode timing
section 24 power-down modes rev. 1.00 mar. 17, 2008 page 784 of 862 rej09b0429-0100 24.7 module stop mode module stop mode can be individually set for each on-chip peripheral module. when the corresponding mstp bit in mstpcr and submstp is set to 1, module operation stops at the end of the bus cycle and a transition is made to module stop mode. in turn, when the corresponding mstp bit is cleared to 0, module stop mode is cancelled and the module operation resumes at the end of the bus cycle. in module stop mode, the internal states of on-chip peripheral modules other than the pwmx, a/d converte r, and part of the sci are retained. after the reset state is cancelled, all modules other than dtc are in module stop mode. while an on-chip peripheral modul e is in module stop mode, read /write access to its registers is disabled. 24.8 usage notes 24.8.1 i/o port status the status of the i/o ports is retained in software standby mode. therefore, when a high level is output, the current consumption is not reduced by the amount of current to support the high level output. 24.8.2 current consumpt ion when waiting for oscillation settling the current consumption increases during oscillation settling. 24.8.3 dtc module stop mode if the dtc module stop mode specification and dtc bus request occur simultaneously, the bus is released to the dtc and the mstp bit cannot be set to 1. after completing the dtc bus cycle, set the mstp bit to 1 again. 24.8.4 notes on subclock usage when using the subclock, make a transition to power-down mode after setting the excle bit in lpwrcr to 1 and loading the subclock two or more cycles. when not using the subclock, the excle bit should not be set to 1.
section 25 list of registers rev. 1.00 mar. 17, 2008 page 785 of 862 rej09b0429-0100 section 25 list of registers the register list gives information on the on-chip i/o register addresses, how the register bits are configured, and the register states in each operating mode. the information is given as shown below. 1. register addresses (address order) ? registers are listed from the lower allocation addresses. ? the msb-side address is indi cated for 16-bit addresses. ? registers are classified by functional modules. ? the access size is indicated. 2. register bits ? bit configurations of the registers are describe d in the same order as the register addresses (address order) above. ? reserved bits are indicated by ? in the bit name column. ? the bit number in the bit-name column indicates that the whol e register is allocated as a counter or for holding data. ? 16-bit registers are indicated from the bit on the msb side. 3. register states in each operating mode ? register states are described in the same orde r as the register addresses (address order) above. ? the register states described here are for the basic operating mode s. if there is a specific reset for an on-chip peripheral module, refer to th e section on that on-chip peripheral module.
section 25 list of registers rev. 1.00 mar. 17, 2008 page 786 of 862 rej09b0429-0100 25.1 register addresses (address order) the data bus width indicates the numbers of bits by which the register is accessed. the number of access states indicates the number of states based on the specified reference clock. note: access to undefined or reserved addresses is prohibited. since operation or continued operation is not guaranteed when these regist ers are accessed, do not attempt such access. register name abbreviation number of bits address module data bus width number of access states receive buffer register frbr 8 h'fc80 scif 16 2 transmitter holding register fthr 8 h'fc80 scif 16 2 divisor latch l fdll 8 h'fc80 scif 16 2 interrupt enable register fier 8 h'fc81 scif 16 2 divisor latch h fdlh 8 h'fc81 scif 16 2 interrupt identification register fiir 8 h'fc82 scif 16 2 fifo control register ffcr 8 h'fc82 scif 16 2 line control register flcr 8 h'fc83 scif 16 2 modem control register fmcr 8 h'fc84 scif 16 2 line status register flsr 8 h'fc85 scif 16 2 modem status register fmsr 8 h'fc86 scif 16 2 scratch pad register fscr 8 h'fc87 scif 16 2 scif control register scifcr 8 h'fc88 scif 16 2 host interface control register 4 hicr4 8 h'fd00 lpc 16 2 bt status register 0 btsr0 8 h'fd02 lpc 16 2 bt status register 1 btsr1 8 h'fd03 lpc 16 2 bt control/status register 0 btcsr0 8 h'fd04 lpc 16 2 bt control/status register 1 btcsr1 8 h'fd05 lpc 16 2 bt control register btcr 8 h'fd06 lpc 16 2 bt interrupt mask register btimsr 8 h'fd07 lpc 16 2 smic flag register smicflg 8 h'fd08 lpc 16 2 host interface control register 5 hicr5 8 h'fd09 lpc 16 2 smic control/status register smiccsr 8 h'fd0a lpc 16 2 smic data register smicdtr 8 h'fd0b lpc 16 2
section 25 list of registers rev. 1.00 mar. 17, 2008 page 787 of 862 rej09b0429-0100 register name abbreviation number of bits address module data bus width number of access states smic interrupt register 0 smicir0 8 h'fd0c lpc 16 2 smic interrupt register 1 smicir1 8 h'fd0e lpc 16 2 serirq control register3 sirqcr3 8 h'fd0f lpc 16 2 bidirectional data register 0mw twr0mw 8 h'fd10 lpc 16 2 bidirectional data register 0sw twr0sw 8 h'fd10 lpc 16 2 bidirectional data register 1 twr1 8 h'fd11 lpc 16 2 bidirectional data register 2 twr2 8 h'fd12 lpc 16 2 bidirectional data register 3 twr3 8 h'fd13 lpc 16 2 bidirectional data register 4 twr4 8 h'fd14 lpc 16 2 bidirectional data register 5 twr5 8 h'fd15 lpc 16 2 bidirectional data register 6 twr6 8 h'fd16 lpc 16 2 bidirectional data register 7 twr7 8 h'fd17 lpc 16 2 bidirectional data register 8 twr8 8 h'fd18 lpc 16 2 bidirectional data register 9 twr9 8 h'fd19 lpc 16 2 bidirectional data register 10 twr10 8 h'fd1a lpc 16 2 bidirectional data register 11 twr11 8 h'fd1b lpc 16 2 bidirectional data register 12 twr12 8 h'fd1c lpc 16 2 bidirectional data register 13 twr13 8 h'fd1d lpc 16 2 bidirectional data register 14 twr14 8 h'fd1e lpc 16 2 bidirectional data register 15 twr15 8 h'fd1f lpc 16 2 input data register 3 idr3 8 h'fd20 lpc 16 2 output data register 3 odr3 8 h'fd21 lpc 16 2 status register 3 str3 8 h'fd22 lpc 16 2 serirq control register 4 sirqcr4 8 h'fd23 lpc 16 2 lpc channel 3 address register h ladr3h 8 h'fd24 lpc 16 2 lpc channel 3 address register l ladr3l 8 h'fd25 lpc 16 2 serirq control register 0 sirqcr0 8 h'fd26 lpc 16 2 serirq control register 1 sirqcr1 8 h'fd27 lpc 16 2 input data register 1 idr1 8 h'fd28 lpc 16 2 output data register 1 odr1 8 h'fd29 lpc 16 2 status register 1 str1 8 h'fd2a lpc 16 2
section 25 list of registers rev. 1.00 mar. 17, 2008 page 788 of 862 rej09b0429-0100 register name abbreviation number of bits address module data bus width number of access states serirq control register 5 sirqcr5 8 h'fd2b lpc 16 2 input data register 2 idr2 8 h'fd2c lpc 16 2 output data register 2 odr2 8 h'fd2d lpc 16 2 status register 2 str2 8 h'fd2e lpc 16 2 host interface select register hisel 8 h'fd2f lpc 16 2 host interface control register 0 hicr0 8 h'fd30 lpc 16 2 host interface control register 1 hicr1 8 h'fd31 lpc 16 2 host interface control register 2 hicr2 8 h'fd32 lpc 16 2 host interface control register 3 hicr3 8 h'fd33 lpc 16 2 bt data buffer btdtr 8 h'fd35 lpc 16 2 bt fifo valid size register 0 btfvsr0 8 h'fd36 lpc 16 2 bt fifo valid size register 1 btfvsr1 8 h'fd37 lpc 16 2 lpc channel 1, 2 address register h ladr12h 8 h'fd38 lpc 16 2 lpc channel 1, 2 address register l ladr12l 8 h'fd39 lpc 16 2 scif address register h scifadrh 8 h'fd3a lpc 16 2 scif address register l scifadrl 8 h'fd3b lpc 16 2 sub-chip module stop control register bh submstpbh 8 h'fe3e system 8 2 sub-chip module stop control register bl submstpbl 8 h'fe3f system 8 2 event count status register ecs 16 h'fe40 evc 16 2 event count control register eccr 8 h'fe42 evc 8 2 module stop control register a mstpcra 8 h'fe43 system 8 2 noise canceler enable register p6nce 8 h'fe44 port 8 2 noise canceler mode control register p6ncmc 8 h'fe45 port 8 2 noise canceler c ycle setting register nccs 8 h'fe46 port 8 2 port e output data register peodr 8 h'fe48 port 8 2 port f output data register pfodr 8 h'fe49 port 8 2 port e input data register pepin 8 h'fe4a port 8 2 port e data direction register peddr 8 h'fe4a port 8 2 port f input data register pfpin 8 h'fe4b port 8 2 port f data direction register pfddr 8 h'fe4b port 8 2
section 25 list of registers rev. 1.00 mar. 17, 2008 page 789 of 862 rej09b0429-0100 register name abbreviation number of bits address module data bus width number of access states port c output data register pcodr 8 h'fe4c port 8 2 port d output data register pdodr 8 h'fe4d port 8 2 port c input data register pcpin 8 h'fe4e port 8 2 port c data direction register pcddr 8 h'fe4e port 8 2 port d input data register pdpin 8 h'fe4f port 8 2 port d data direction register pdddr 8 h'fe4f port 8 2 flash code control/status register fccs 8 h'fe88 flash 8 2 flash program code select register fpcs 8 h'fe89 flash 8 2 flash erase code select register fecs 8 h'fe8a flash 8 2 flash key code register fkey 8 h'fe8c flash 8 2 flash mat select register fmats 8 h'fe8d flash 8 2 flash transfer destination address register ftdar 8 h'fe8e flash 8 2 i 2 c bus control register_4 iccr_4 8 h'fe90 iic_4 8 2 i 2 c bus status register_4 icsr_4 8 h'fe91 iic_4 8 2 i 2 c bus data register_4 icdr_4 8 h'fe92 iic_4 8 2 second slave address register_4 sarx_4 8 h'fe92 iic_4 8 2 i 2 c bus mode register_4 icmr_4 8 h'fe93 iic_4 8 2 slave address register_4 sar_4 8 h'fe93 iic_4 8 2 i 2 c bus control register_5 iccr_5 8 h'fe94 iic_5 8 2 i 2 c bus status register_5 icsr_5 8 h'fe95 iic_5 8 2 i 2 c bus data register_5 icdr_5 8 h'fe96 iic_5 8 2 second slave address register_5 sarx_5 8 h'fe96 iic_5 8 2 i 2 c bus mode register_5 icmr_5 8 h'fe97 iic_5 8 2 slave address register_5 sar_5 8 h'fe97 iic_5 8 2 serial mode register_1 smr_1 8 h'fe98 sci_1 8 2 bit rate register_1 brr_1 8 h'fe99 sci_1 8 2 serial control register_1 scr_1 8 h'fe9a sci_1 8 2 transmit data register_1 tdr_1 8 h'fe9b sci_1 8 2 serial status register_1 ssr_1 8 h'fe9c sci_1 8 2 receive data register_1 rdr_1 8 h'fe9d sci_1 8 2
section 25 list of registers rev. 1.00 mar. 17, 2008 page 790 of 862 rej09b0429-0100 register name abbreviation number of bits address module data bus width number of access states smart card mode register_1 scmr_1 8 h'fe9e sci_1 8 2 a/d data register a addra 16 h'fea0 adc 16 2 a/d data register b addrb 16 h'fea2 adc 16 2 a/d data register c addrc 16 h'fea4 adc 16 2 a/d data register d addrd 16 h'fea6 adc 16 2 a/d data register e addre 16 h'fea8 adc 16 2 a/d data register f addrf 16 h'feaa adc 16 2 a/d data register g addrg 16 h'feac adc 16 2 a/d data register h addrh 16 h'feae adc 16 2 a/d control/status register adcsr 8 h'feb0 adc 8 2 a/d control register adcr 8 h'feb1 adc 8 2 serial multiplexed mode register 0 smr0 8 h'feb8 smx 8 2 serial multiplexed mode register 1 smr1 8 h'feb9 smx 8 2 port 6 pull-up mos control register p6pcr 8 h'febc port 8 2 pin function control register pinfncr 8 h'febe port 8 2 port 4 pull-up mos control register p4pcr 8 h'febf port 8 2 i 2 c bus control register_3 iccr_3 8 h'fec0 iic_3 8 2 i 2 c bus status register_3 icsr_3 8 h'fec1 iic_3 8 2 i 2 c bus data register_3 icdr_3 8 h'fec2 iic_3 8 2 second slave address register_3 sarx_3 8 h'fec2 iic_3 8 2 i 2 c bus mode register_3 icmr_3 8 h'fec3 iic_3 8 2 slave address register_3 sar_3 8 h'fec3 iic_3 8 2 i 2 c bus control register_2 iccr_2 8 h'fec8 iic_2 8 2 i 2 c bus status register_2 icsr_2 8 h'fec9 iic_2 8 2 i 2 c bus data register_2 icdr_2 8 h'feca iic_2 8 2 second slave address register_2 sarx_2 8 h'feca iic_2 8 2 i 2 c bus mode register_2 icmr_2 8 h'fecb iic_2 8 2 slave address register_2 sar_2 8 h'fecb iic_2 8 2 pwmx (d/a) data register a_1 dadra_1 16 h'fecc pwmx_1 8 4 pwmx (d/a) control register_1 dacr_1 8 h'fecc pwmx_1 8 2 pwmx (d/a) data register b_1 dadrb_1 16 h'fece pwmx_1 8 4
section 25 list of registers rev. 1.00 mar. 17, 2008 page 791 of 862 rej09b0429-0100 register name abbreviation number of bits address module data bus width number of access states pwmx (d/a) counter_1 dacnt_1 16 h'fece pwmx_1 8 4 crc control register crccr 8 h'fed4 crc 16 2 crc data input register crcdir 8 h'fed5 crc 16 2 crc data output register crcdor 16 h'fed6 crc 16 2 i 2 c bus extended control register_0 icxr_0 8 h'fed8 iic_0 8 2 i 2 c bus extended control register_1 icxr_1 8 h'fed9 iic_1 8 2 i 2 c smbus control register icsmbcr 8 h'fedb iic 8 2 i 2 c bus extended control register_2 icxr_2 8 h'fedc iic_2 8 2 i 2 c bus extended control register_3 icxr_3 8 h'fedd iic_3 8 2 i 2 c bus transfer select register iicx3 8 h'fedf iic 8 2 i 2 c bus extended control register_4 icxr_4 8 h'fee0 iic_4 8 2 i 2 c bus extended control register_5 icxr_5 8 h'fee1 iic_5 8 2 keyboard comparator control register kbcomp 8 h'fee4 evc 8 2 interrupt control register d icrd 8 h'fee7 int 8 2 interrupt control register a icra 8 h'fee8 int 8 2 interrupt control register b icrb 8 h'fee9 int 8 2 interrupt control register c icrc 8 h'feea int 8 2 irq status register isr 8 h'feeb int 8 2 irq sense control register h iscrh 8 h'feec int 8 2 irq sense control register l iscrl 8 h'feed int 8 2 dtc enable register a dtcera 8 h'feee dtc 8 2 dtc enable register b dtcerb 8 h'feef dtc 8 2 dtc enable register c dtcerc 8 h'fef0 dtc 8 2 dtc enable register d dtcerd 8 h'fef1 dtc 8 2 dtc enable register e dtcere 8 h'fef2 dtc 8 2 dtc vector register dtvecr 8 h'fef3 dtc 8 2 address break control register abrkcr 8 h'fef4 int 8 2 break address register a bara 8 h'fef5 int 8 2 break address register b barb 8 h'fef6 int 8 2 break address register c barc 8 h'fef7 int 8 2 irq enable register 16 ier16 8 h'fef8 int 8 2
section 25 list of registers rev. 1.00 mar. 17, 2008 page 792 of 862 rej09b0429-0100 register name abbreviation number of bits address module data bus width number of access states irq status register 16 isr16 8 h'fef9 int 8 2 irq sense control register 16h iscr16h 8 h'fefa int 8 2 irq sense control register 16l iscr16l 8 h'fefb int 8 2 irq sense port select register 16 issr16 8 h'fefc port 8 2 irq sense port select register issr 8 h'fefd port 8 2 port control register 0 ptcnt0 8 h'fefe port 8 2 bus control register 2 bcr2 8 h'ff80 bsc 8 2 wait state control register 2 wscr2 8 h'ff81 bsc 8 2 peripheral clock select register pcsr 8 h'ff82 pwmx 8 2 system control register 2 syscr2 8 h'ff83 system 8 2 standby control register sbycr 8 h'ff84 system 8 2 low power control register lpwrcr 8 h'ff85 system 8 2 module stop control register h mstpcrh 8 h'ff86 system 8 2 module stop control register l mstpcrl 8 h'ff87 system 8 2 i 2 c bus control register_1 iccr_1 8 h'ff88 iic_1 8 2 i 2 c bus status register _1 icsr_1 8 h'ff89 iic_1 8 2 i 2 c bus data register _1 icdr_1 8 h'ff8e iic_1 8 2 second slave address register _1 sarx_1 8 h'ff8e iic_1 8 2 i 2 c bus mode register_1 icmr_1 8 h'ff8f iic_1 8 2 slave address register _1 sar_1 8 h'ff8f iic_1 8 2 timer interrupt enable register tier 8 h'ff90 frt 8 2 timer control/status register tcsr 8 h'ff91 frt 8 2 free-running counter frc 16 h'ff92 frt 16 2 output compare register a ocra 16 h'ff94 frt 16 2 output compare register b ocrb 16 h'ff95 frt 16 2 timer control register tcr 8 h'ff96 frt 16 2 timer output compare control register tocr 8 h'ff97 frt 16 2 output compare register ar ocrar 16 h'ff98 frt 16 2 output compare register af ocraf 16 h'ff9a frt 16 2 pwmx (d/a) data register a_0 dadra_0 16 h'ffa0 pwmx_0 8 4 pwmx (d/a) control register_0 dacr_0 8 h'ffa0 pwmx_0 8 2
section 25 list of registers rev. 1.00 mar. 17, 2008 page 793 of 862 rej09b0429-0100 register name abbreviation number of bits address module data bus width number of access states pwmx (d/a) data register b_0 dadrb_0 16 h'ffa6 pwmx_0 8 4 pwmx (d/a) counter_0 dacnt_0 16 h'ffa6 pwmx_0 8 4 timer control/status register _0 (read) tcsr_0 8 h'ffa8 wdt_0 16 2 timer control/status register _0 (write) tcsr_0 16 h'ffa8 wdt_0 16 2 timer counter_0 (read) tcnt_0 8 h'ffa9 wdt_0 16 2 timer counter_0 (write) tcnt_0 16 h'ffa8 wdt_0 16 2 port a output data register paodr 8 h'ffaa port 8 2 port a input data register papin 8 h'ffab port 8 2 port a data direction register paddr 8 h'ffab port 8 2 port 1 pull-up mos control register p1pcr 8 h'ffac port 8 2 port 2 pull-up mos control register p2pcr 8 h'ffad port 8 2 port 3 pull-up mos control register p3pcr 8 h'ffae port 8 2 port 1 data direction register p1ddr 8 h'ffb0 port 8 2 port 2 data direction register p2ddr 8 h'ffb1 port 8 2 port 1 data register p1dr 8 h'ffb2 port 8 2 port 2 data register p2dr 8 h'ffb3 port 8 2 port 3 data direction register p3ddr 8 h'ffb4 port 8 2 port 4 data direction register p4ddr 8 h'ffb5 port 8 2 port 3 data register p3dr 8 h'ffb6 port 8 2 port 4 data register p4dr 8 h'ffb7 port 8 2 port 5 data direction register p5ddr 8 h'ffb8 port 8 2 port 6 data direction register p6ddr 8 h'ffb9 port 8 2 port 5 data register p5dr 8 h'ffba port 8 2 port 6 data register p6dr 8 h'ffbb port 8 2 port b output data register pbodr 8 h'ffbc port 8 2 port b input data register pbpin 8 h'ffbd port 8 2 port 8 data direction register p8ddr 8 h'ffbd port 8 2 port 7 input data register p7pin 8 h'ffbe port 8 2 port b data direction register pbddr 8 h'ffbe port 8 2 port 8 data register p8dr 8 h'ffbf port 8 2 port 9 data direction register p9ddr 8 h'ffc0 port 8 2
section 25 list of registers rev. 1.00 mar. 17, 2008 page 794 of 862 rej09b0429-0100 register name abbreviation number of bits address module data bus width number of access states port 9 data register p9dr 8 h'ffc1 port 8 2 interrupt enable register ier 8 h'ffc2 int 8 2 serial timer control register stcr 8 h'ffc3 system 8 2 system control register syscr 8 h'ffc4 system 8 2 mode control register mdcr 8 h'ffc5 system 8 2 bus control register bcr 8 h'ffc6 bsc 8 2 wait state control register wscr 8 h'ffc7 bsc 8 2 timer control register_0 tcr_0 8 h'ffc8 tmr_0 8 2 timer control register_1 tcr_1 8 h'ffc9 tmr_1 8 2 timer control/status register_0 tcsr_0 8 h'ffca tmr_0 8 2 timer control/status register_1 tcsr_1 8 h'ffcb tmr_1 8 2 time constant register a_0 tcora_0 8 h'ffcc tmr_0 8 2 time constant register a_1 tcora_1 8 h'ffcd tmr_1 8 2 time constant register b_0 tcorb_0 8 h'ffce tmr_0 8 2 time constant register b_1 tcorb_1 8 h'ffcf tmr_1 8 2 timer counter_0 tcnt_0 8 h'ffd0 tmr_0 8 2 timer counter_1 tcnt_1 8 h'ffd1 tmr_1 8 2 i 2 c bus control register_0 iccr_0 8 h'ffd8 iic_0 8 2 i 2 c bus status register_0 icsr_0 8 h'ffd9 iic_0 8 2 i 2 c bus data register_0 icdr_0 8 h'ffde iic_0 8 2 second slave address register_0 sarx_0 8 h'ffde iic_0 8 2 i 2 c bus mode register_0 icmr_0 8 h'ffdf iic_0 8 2 slave address register_0 sar_0 8 h'ffdf iic_0 8 2 serial mode register_3 smr_3 8 h'ffe0 sci_3 8 2 bit rate register_3 brr_3 8 h'ffe1 sci_3 8 2 serial control register_3 scr_3 8 h'ffe2 sci_3 8 2 transmit data register_3 tdr_3 8 h'ffe3 sci_3 8 2 serial status register_3 ssr_3 8 h'ffe4 sci_3 8 2 receive data register_3 rdr_3 8 h'ffe5 sci_3 8 2 smart card mode register_3 scmr_3 8 h'ffe6 sci_3 8 2 timer control/ status register_1 (read) tcsr_1 8 h'ffea wdt_1 16 2
section 25 list of registers rev. 1.00 mar. 17, 2008 page 795 of 862 rej09b0429-0100 register name abbreviation number of bits address module data bus width number of access states timer control/ status register_1 (write) tcsr_1 16 h'ffea wdt_1 16 2 timer counter_1 (read) tcnt_1 8 h'ffeb wdt_1 16 2 timer counter_1 (write) tcnt_1 16 h'ffea wdt_1 16 2 timer control register_x tcr_x 8 h'fff0 tmr_x 8 2 timer control/status register_x tcsr_x 8 h'fff1 tmr_x 8 2 timer counter_x tcnt_x 8 h'fff4 tmr_x 8 2 time constant register a_x tcora_x 8 h'fff6 tmr_x 8 2 time constant register b_x tcorb_x 8 h'fff7 tmr_x 8 2 timer control register_y tcr_y 8 h'fff0 tmr_y 8 2 timer control/status register_y tcsr_y 8 h'fff1 tmr_y 8 2 time constant register a_y tcora_y 8 h'fff2 tmr_y 8 2 time constant register b_y tcorb_y 8 h'fff3 tmr_y 8 2 timer counter_y tcnt_y 8 h'fff4 tmr_y 8 2 timer connection register s tconrs 8 h'fffe tmr 8 2
section 25 list of registers rev. 1.00 mar. 17, 2008 page 796 of 862 rej09b0429-0100 25.2 register bits register addresses and bit names of the on-chip peripheral modules are described below. each line covers eight bits, so 16-b it registers are shown as 2 lines. register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module frbr bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 fthr bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 fdll bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 fier ? ? ? ? edssi elsi etbei erbfi fdlh bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 fiir fifoe1 fifoe0 ? ? intid2 intid1 intid0 intpend ffcr rcvrtrig1 rcvrtrig0 ? ? dmamode xmitfrst rcvrfrst fifoe flcr dlab break stickparity eps pen stop cls1 cls0 fmcr ? ? ? loopback out2 out1 rts dtr flsr rxfifoerr temt thre bi fe pe oe dr fmsr dcr ri dsr cts ddcd teri ddsr dcts fscr bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scifcr scifoe1 scifoe0 bit 5 out2loop cksel1 cksel0 scifrst regrst scif hicr4 ladr12sel ? ? ? swenbl kcsenbl smcenbl btenbl btsr0 ? ? ? frdi hrdi hwri hbtwi hbtri btsr1 ? hrsti irqcri bevti b2hi h2bi crrpi crwpi btcsr0 ? fsel1 fsel0 frdie hrdie hwrie hbtwie hbtrie btcsr1 rstrenbl hrstie irqcrie bevtie b2hie h2bie crrpie crwpie btcr b_busy h_busy oem0 bevt_atn b2h_atn h2b_ atn clr_rd_ ptr clr_wr_ ptr btimsr bmc_ hwrst ? ? oem3 oem2 oem1 b2h_irq b2h_irq_ en smicflg rx_data_ rdy tx_data_ rdy ? smi sevt_atn sms_atn ? busy hicr5 ? ? ? ? ? ? scife ? smiccsr bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 smicdtr bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 smicir0 ? ? ? hdtwi hdtri stari ctlwi busyi lpc
section 25 list of registers rev. 1.00 mar. 17, 2008 page 797 of 862 rej09b0429-0100 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module smicir1 ? ? ? hdtwie hdtrie starie ctlwie busyie sirqcr3 ? ? ? ? sc0sirq3 sc0sirq2 sc0sirq1 sc0sirq0 twr0mw bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr0sw bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr2 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr4 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr5 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr6 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr7 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr9 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr10 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr11 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr12 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr13 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr14 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr15 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 idr3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 odr3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 str3 * 1 ibf3b obf3b mwmf swmf c/ d 3 dbu32 ibf3a obf3a str3 * 2 dbu37 dbu36 dbu35 dbu34 c/ d 3 dbu32 ibf3a obf3a sirqcr4 irq15e irq14e irq13e irq8e irq7e irq5e irq4e irq3e ladr3h bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 ladr3l bit 7 bit 6 bit 5 bit 4 bit 3 ? bit 1 twre sirqcr0 q/c selreq iedir2 smie3b smie3a smie2 irq12e1 irq1e1 sirqcr1 irq11e3 irq10e3 irq9e3 irq6 e3 irq11e2 irq10e2 irq9e2 irq6e2 idr1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 odr1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 str1 dbu17 dbu16 dbu15 dbu14 c/ d 1 dbu12 ibf1 obf1 sirqcr5 selirq15 selirq14 selirq13 selir q8 selirq7 selirq5 selirq4 selirq3 lpc
section 25 list of registers rev. 1.00 mar. 17, 2008 page 798 of 862 rej09b0429-0100 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module idr2 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 odr2 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 str2 dbu27 dbu26 dbu25 dbu24 c/ d 2 dbu22 ibf2 obf2 hisel selstr3 selirq11 selirq10 selir q9 selirq6 selsmi selirq12 selirq1 hicr0 lpc3e lpc2e lpc1e fga20e sdwne pmee lsmie lscie hicr1 lpcbsy clkreq irqbsy lr stb sdwnb pmeb lsmib lscib hicr2 ga20 lrst sdwn abrt ibfie3 ibfie2 ibfie1 errie hicr3 lframe clkrun serirq lr eset lpcpd pme lsmi lsci sirqcr2 iedir3 ? ? ? ? ? ? ? btdtr bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 btfvsr0 n7 n6 n5 n4 n3 n2 n1 n0 btfvsr1 n7 n6 n5 n4 n3 n2 n1 n0 ladr12h bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 ladr12l bit 7 bit 6 bit 5 bit 4 bit 3 ? bit 1 bit 0 scifadrh bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 scifadrl bit 7 bit 6 bit 5 bit 4 bit 3 ? ? ? lpc submstpbh smstpb15 smstpb14 smstpb13 smstpb12 smstpb11 smstpb10 smstpb9 smstpb8 submstpbl smstpb7 smstpb6 smstpb5 smstpb4 scif smstpb2 lpc smstpb0 system ecs e15 e14 e13 e12 e11 e10 e9 e8 e7 e6 e5 e4 e3 e2 e1 e0 eccr edsb ? ? ? ecsb3 ecsb2 ecsb1 ecsb0 evc mstpcra mstpa7 mstpa6 mstpa5 mst pa4 mstpa3 mstpa2 mstpa1 mstpa0 system p6nce p67nce p66nce p 65nce p64nce p63nce p 62nce p61nce p60nce p6ncmc p67ncmc p66ncmc p65ncmc p64ncm c p63ncmc p62ncmc p61ncmc p60ncmc nccs ? ? ? ? ? ncck2 ncck1 ncck0 peodr pe7odr pe6odr pe5odr pe4o dr pe3odr pe2odr pe1odr pe0odr pfodr ? ? ? ? pf3odr pf2odr pf0odr pf0odr pepin pe7pin pe6pin pe5pin pe4pi n pe3pin pe2pin pe1pin pe0pin peddr pe7ddr pe6ddr pe5ddr pe4ddr pe3ddr pe2ddr pe1ddr pe0ddr pfpin ? ? ? ? pf3pin pf2pin pf1pin pf0pin pfddr ? ? ? ? pf3ddr pf2ddr pf1ddr pf0ddr pcodr pc7odr pc6odr pc5odr pc4odr pc3odr pc2odr pc1odr pc0odr port
section 25 list of registers rev. 1.00 mar. 17, 2008 page 799 of 862 rej09b0429-0100 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module pdodr pd7odr pd6odr pd5odr pd4odr pd3odr pd2odr pd1odr pd0odr pcpin pc7pin pc6pin pc 5pin pc4pin pc3pin pc2pin pc1pin pc0pin pcddr pc7ddr pc6ddr pc5ddr pc4ddr pc3ddr pc2ddr pc1ddr pc0ddr pdpin pd7pin pd6pin pd 5pin pd4pin pd3pin pd2pin pd1pin pd0pin pdddr pd7ddr pd6ddr pd5ddr pd4ddr pd3ddr pd2ddr pd1ddr pd0ddr port fccs fwe ? ? fler weinte ? ? sco fpcs ? ? ? ? ? ? ? ppvs fecs ? ? ? ? ? ? ? epvb fkey k7 k6 k5 k4 k3 k2 k1 k0 fmats ms7 ms6 ms5 ms4 ms3 ms2 ms1 ms0 ftdar tder tda6 tda5 tda4 tda3 tda2 tda1 tda0 flash iccr_4 ice ieic mst trs acke bbsy iric scp icsr_4 estp stop irtr aasx al aas adz ackb icdr_4 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sarx_4 svax6 svax5 svax4 svax3 svax2 svax1 svax0 fsx icmr_4 mls wait cks2 c ks1 cks0 bc2 bc1 bc0 sar_4 sva6 sva5 sva4 sva3 sva2 sva1 sva0 fs iic_4 iccr_5 ice ieic mst trs acke bbsy iric scp icsr_5 estp stop irtr aasx al aas adz ackb icdr_5 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sarx_5 svax6 svax5 svax4 svax3 svax2 svax1 svax0 fsx icmr_5 mls wait cks2 c ks1 cks0 bc2 bc1 bc0 sar_5 sva6 sva5 sva4 sva3 sva2 sva1 sva0 fs iic_5 smr_1 * 3 c/ a (gm) chr (blk) pe (pe) o/ e (o/ e ) stop (bcp1) mp (bcp0) cks1 (cks1) cks0 (cks0) brr_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scr_1 tie rie te re mpie teie cke1 cke0 tdr_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ssr_1 * 3 tdre (tdre) rdrf (rrf) orer (orer) fer (ers) per (per) tend (tend) mpb (mpb) mpbt (mpbt) rdr_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scmr_1 ? ? ? ? sdir sinv ? smif sci_1
section 25 list of registers rev. 1.00 mar. 17, 2008 page 800 of 862 rej09b0429-0100 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module addra ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 ? ? ? ? ? ? addrb ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 ? ? ? ? ? ? addrc ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 ? ? ? ? ? ? addrd ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 ? ? ? ? ? ? addre ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 ? ? ? ? ? ? addrf ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 ? ? ? ? ? ? addrg ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 ? ? ? ? ? ? addrh ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 ? ? ? ? ? ? adcsr adf adie adst ? ? ch2 ch1 ch0 adcr trgs1 trgs0 scane scans cks1 cks0 adstclr extrgs adc smr0 dcd1 ri1 dsr1 sme ? sm2 sm1 sm0 smr1 cts1 dtr1 rts1 cts3 ? rts3 ? ? smx p6pcr p67pcr p66pcr p65pcr p64p cr p63pcr p62pcr p61pcr p60pcr pinfncr ? ? ? ? ? serirq off lpcpd off clkrun off p4pcr p47pcr p46pcr p45pcr p44p cr p43pcr p42pcr p41pcr p40pcr port iccr_3 ice ieic mst trs acke bbsy iric scp icsr_3 estp stop irtr aasx al aas adz ackb icdr_3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sarx_3 svax6 svax5 svax4 svax3 svax2 svax1 svax0 fsx icmr_3 mls wait cks2 c ks1 cks0 bc2 bc1 bc0 sar_3 sva6 sva5 sva4 sva3 sva2 sva1 sva0 fs iic_3 iccr_2 ice ieic mst trs acke bbsy iric scp icsr_2 estp stop irtr aasx al aas adz ackb iic_2
section 25 list of registers rev. 1.00 mar. 17, 2008 page 801 of 862 rej09b0429-0100 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module icdr_2 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sarx_2 svax6 svax5 svax4 svax3 svax2 svax1 svax0 fsx icmr_2 mls wait cks2 c ks1 cks0 bc2 bc1 bc0 sar_2 sva6 sva5 sva4 sva3 sva2 sva1 sva0 fs iic_2 da13 da12 da11 da10 da9 da8 da7 da6 dadra_1 da5 da4 da3 da2 da1 da0 cfs ? dacr_1 ? pwme ? ? oeb oea os cks da13 da12 da11 da10 da9 da8 da7 da6 dadrb_1 da5 da4 da3 da2 da1 da0 cfs regs uc7 uc6 uc5 uc4 uc3 uc2 uc1 uc0 dacnt_1 uc8 uc9 uc10 uc11 uc12 uc13 ? regs pwmx_1 crccr dorclr ? ? ? ? lms g1 g0 crcdir bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 crcdor bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 crc icxr_0 stopim hnds icdrf icdre alie alsl fnc1 fnc0 iic_0 icxr_1 stopim hnds icdrf icdre alie alsl fnc1 fnc0 iic_1 icsmbcr smb5e smb4e smb3e smb2e smb1e smb0e fsel1 fsel0 iic icxr_2 stopim hnds icdrf icdre alie alsl fnc1 fnc0 iic_2 icxr_3 stopim hnds icdrf icdre alie alsl fnc1 fnc0 iic_3 iicx3 ? ? ? ? tcss iicx5 iicx4 iicx3 iic icxr_4 stopim hnds icdrf icdre alie alsl fnc1 fnc0 iic_4 icxr_5 stopim hnds icdrf icdre alie alsl fnc1 fnc0 iic_5 kbcomp evente ? ? ? ? ? ? ? evc icrd icrd7 icrd6 ? ? ? ? icrd1 ? icra icra7 icra6 icra5 icra4 icra3 icra2 icra1 icra0 icrb icrb7 icrb6 ? icrb4 icrb3 i crb2 icrb1 icrb0 icrc icrc7 icrc6 icrc5 i crc4 icrc3 icrc2 icrc1 ? isr irq7f irq6f irq5f irq4 f irq3f irq2f irq1f irq0f iscrh irq7scb irq7sca irq6 scb irq6sca irq5scb ir q5sca irq4scb irq4sca iscrl irq3scb irq3sca ir q2scb irq2sca irq1scb ir q1sca irq0scb irq0sca int
section 25 list of registers rev. 1.00 mar. 17, 2008 page 802 of 862 rej09b0429-0100 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module dtcera dtcea7 dtcea6 dtcea5 dtcea4 dtcea3 ? ? ? dtcerb ? dtceb6 dtceb5 ? ? ? ? ? dtcerc ? ? ? dtcec4 ? dtcec2 dtcec1 dtcec0 dtcerd dtced7 ? ? dtced4 dtced3 ? ? ? dtcere ? ? ? ? dtcee3 dtcee2 dtcee1 dtcee0 dtvecr swdte dtvec6 dtvec5 dtvec 4 dtvec3 dtvec2 dtvec1 dtvec0 dtc abrkcr cmf ? ? ? ? ? ? bie bara a23 a22 a21 a20 a19 a18 a17 a16 barb a15 a14 a13 a12 a11 a10 a9 a8 barc a7 a6 a5 a4 a3 a2 a1 ? ier16 irq15e irq14e irq13e irq12e irq11e irq10e irq9e irq8e isr16 irq15f irq14f irq13f irq12f irq11f irq10f irq9f irq8f iscr16h irq15scb irq15sca irq14scb irq14sca irq13scb irq13sca irq12scb irq12sca iscr16l irq11scb irq11sca irq10scb irq10sca irq9scb irq9sca irq8scb irq8sca int issr16 iss15 iss14 iss13 iss12 iss11 iss10 iss9 iss8 issr iss7 iss6 iss5 iss4 iss3 iss2 iss1 iss0 ptcnt0 scpesel1 scpfsel3 ? ? ? ? obe ? port bcr2 ? ? ? ? adfulle excks ? ? wscr2 wms10 wc11 wc10 ? ? ? ? ? bsc pcsr pwckx1b pwckx1a pw ckx0b pwckx0a pwckx1c ? ? pwckx0c pwmx syscr2 ? ? ? ? admxe ? ? ? sbycr ssby sts2 sts1 sts0 dtspeed sck2 sck1 sck0 lpwrcr ? ? nesel excle ? pnccs pncah ? mstpcrh mstp15 mstp14 mstp13 mstp12 mstp11 mstp10 mstp9 mstp8 mstpcrl mstp7 mstp6 mstp5 mstp4 mstp3 mstp2 mstp1 mstp0 system iccr_1 ice ieic mst trs acke bbsy iric scp icsr_1 estp stop irtr aasx al aas adz ackb icdr_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sarx_1 svax6 svax5 svax4 svax3 svax2 svax1 svax0 fsx icmr_1 mls wait cks2 c ks1 cks0 bc2 bc1 bc0 sar_1 sva6 sva5 sva4 sva3 sva2 sva1 sva0 fs iic_1
section 25 list of registers rev. 1.00 mar. 17, 2008 page 803 of 862 rej09b0429-0100 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tier ? ? ? ? ociae ocibe ovie ? tcsr ? ? ? ? ocfa ocfb ovf cclra frc bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ocra bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ocrb bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcr ? ? ? ? ? ? cks1 cks0 tocr ? ocrams icrs ocrs ? ? ? ? ocrar bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ocraf bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 frt dadra_0 da13 da12 da11 da10 da9 da8 da7 da6 da5 da4 da3 da2 da1 da0 cfs ? dacr_0 ? pwme ? ? oeb oea os cks dadrb_0 da13 da12 da11 da10 da9 da8 da7 da6 da5 da4 da3 da2 da1 da0 cfs regs dacnt_0 uc7 uc6 uc5 uc4 uc3 uc2 uc1 uc0 uc8 uc9 uc10 uc11 uc12 uc13 ? regs pwmx_0 tcsr_0 ovf wt/ it tme ? rst/ nmi cks2 cks1 cks0 tcnt_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 wdt_0 paodr pa7odr pa6odr pa5odr pa4o dr pa3odr pa2odr pa1odr pa0odr papin pa7pin pa6pin pa5pin pa4pi n pa3pin pa2pin pa1pin pa0pin paddr pa7ddr pa6ddr pa5ddr pa4ddr pa3ddr pa2ddr pa1ddr pa0ddr p1pcr p17pcr p16pcr p15pcr p14p cr p13pcr p12pcr p11pcr p10pcr p2pcr p27pcr p26pcr p25pcr p24p cr p23pcr p22pcr p21pcr p20pcr p3pcr p37pcr p36pcr p35pcr p34p cr p33pcr p32pcr p31pcr p30pcr p1ddr p17ddr p16ddr p15ddr p14 ddr p13ddr p12ddr p11ddr p10ddr p2ddr p27ddr p26ddr p25ddr p24 ddr p23ddr p22ddr p21ddr p20ddr p1dr p17dr p16dr p15dr p14 dr p13dr p12dr p11dr p10dr port
section 25 list of registers rev. 1.00 mar. 17, 2008 page 804 of 862 rej09b0429-0100 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module p2dr p27dr p26dr p25dr p24 dr p23dr p22dr p21dr p20dr p3ddr p37ddr p36ddr p35ddr p34 ddr p33ddr p32ddr p31ddr p30ddr p4ddr p47ddr p46ddr p45ddr p44 ddr p43ddr p42ddr p41ddr p40ddr p3dr p37dr p36dr p35dr p34 dr p33dr p32dr p31dr p30dr p4dr p47dr p46dr p45dr p44 dr p43dr p42dr p41dr p40dr p5ddr p57ddr p56ddr p55ddr p54 ddr p53ddr p52ddr p51ddr p50ddr p6ddr p67ddr p66ddr p65ddr p64 ddr p63ddr p62ddr p61ddr p60ddr p5dr p57dr p56dr p55dr p54 dr p53dr p52dr p51dr p50dr p6dr p67dr p66dr p65dr p64 dr p63dr p62dr p61dr p60dr pbodr pb7odr pb6odr pb5odr pb4o dr pb3odr pb2odr pb1odr pb0odr pbpin pb7pin pb6pin pb5pin pb4pi n pb3pin pb2pin pb1pin pb0pin p8ddr p87ddr p86ddr p85ddr p84 ddr p83ddr p82ddr p81ddr p80ddr p7pin p77pin p76pin p75pin p74pin p73pin p72pin p71pin p70pin pbddr pb7ddr pb6ddr pb5ddr pb4ddr pb3ddr pb2ddr pb1ddr pb0ddr p8dr p87dr p86dr p85dr p84 dr p83dr p82dr p81dr p80dr p9ddr p97ddr p96ddr p95ddr p94 ddr p93ddr p92ddr p91ddr p90ddr p9dr p97dr p96dr p95dr p94 dr p93dr p92dr p91dr p90dr port ier irq7e irq6e irq5e irq4e irq3e irq2e irq1e irq0e int stcr iicx2 iicx1 iicx0 ? flshe ? icks1 icks0 syscr cs256e iose intm1 intm0 xrst nmieg ? rame mdcr expe ? ? ? ? mds2 mds1 ? system bcr ? icis brstrm brsts1 brsts0 ? ios1 ios0 wscr abw256 ast256 abw ast wms1 wms0 wc1 wc0 bsc tcr_0 cmieb cmiea ovie ? ? cks2 cks1 cks0 tcr_1 cmieb cmiea ovie ? ? cks2 cks1 cks0 tcsr_0 cmfb cmfa ovf adte ? ? ? ? tcsr_1 cmfb cmfa ovf ? ? ? ? ? tcora_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcora_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcorb_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcorb_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcnt_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_0,1
section 25 list of registers rev. 1.00 mar. 17, 2008 page 805 of 862 rej09b0429-0100 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tcnt_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_0,1 iccr_0 ice ieic mst trs acke bbsy iric scp icsr_0 estp stop irtr aasx al aas adz ackb icdr_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sarx_0 svax6 svax5 svax4 svax3 svax2 svax1 svax0 fsx icmr_0 mls wait cks2 c ks1 cks0 bc2 bc1 bc0 sar_0 sva6 sva5 sva4 sva3 sva2 sva1 sva0 fs iic_0 smr_3 * 3 c/ a (gm) chr (blk) pe (pe) o/ e (o/ e ) stop (bcp1) mp (bcp0) cks1 (cks1) cks0 (cks0) brr_3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scr_3 tie rie te re mpie tie cke1 cke0 tdr_3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ssr_3 * 3 tdre (tdre) rdrf (rdrf) orer (orer) fer (ers) per (per) tend (tend) mpb (mpb) mpbt (mpbt) rdr_3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scmr_3 ? ? ? ? sdir sinv ? smif sci_3 tcsr_1 ovf wt/ it tme pss rst/ nmi cks2 cks1 cks0 tcnt_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 wdt_1 tcr_x cmieb cmiea ovie ? ? cks2 cks1 cks0 tcsr_x cmfb cmfa ovf ? ? ? ? ? tcnt_x bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcora_x bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcorb_x bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcr_y cmieb cmiea ovie ? ? cks2 cks1 cks0 tcsr_y cmfb cmfa ovf ? ? ? ? ? tcora_y bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcorb_y bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcnt_y bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tconrs tmrx/y ? ? ? ? ? ? ? tmr_x,y
section 25 list of registers rev. 1.00 mar. 17, 2008 page 806 of 862 rej09b0429-0100 notes: 1. when twre = 1 or selstr3 = 0 2. when twre = 0 and selstr3 = 1 3. some bits have different names in nor mal mode and smart card interface mode. the bit name in smart card interface mode is enclosed in parentheses.
section 25 list of registers rev. 1.00 mar. 17, 2008 page 807 of 862 rej09b0429-0100 25.3 register states in each operating mode register abbreviation reset wdt reset high-speed/ medium-speed sleep module stop software standby hardware standby module frbr initialized initialized ? ? ? ? initialized fthr initialized initialized ? ? ? ? initialized fdll initialized initialized ? ? ? ? initialized fier initialized initialized ? ? ? ? initialized fdlh initialized initialized ? ? ? ? initialized fiir initialized initialized ? ? ? ? initialized ffcr initialized initialized ? ? ? ? initialized flcr initialized initialized ? ? ? ? initialized fmcr initialized initialized ? ? ? ? initialized flsr initialized initialized ? ? ? ? initialized fmsr initialized initialized ? ? ? ? initialized fscr initialized initialized ? ? ? ? initialized scifcr initialized initialized ? ? ? ? initialized scif hicr4 initialized initialized ? ? ? ? initialized btsr0 initialized initialized ? ? ? ? initialized btsr1 initialized initialized ? ? ? ? initialized btcsr0 initialized initialized ? ? ? ? initialized btcsr1 initialized initialized ? ? ? ? initialized btcr initialized initialized ? ? ? ? initialized btimsr initialized initialized ? ? ? ? initialized smicflg initialized initialized ? ? ? ? initialized hicr5 initialized initialized ? ? ? ? initialized smiccsr ? ? ? ? ? ? ? smicdtr ? ? ? ? ? ? ? smicir0 initialized initialized ? ? ? ? initialized smicir1 initialized initialized ? ? ? ? initialized sirqcr3 initialized initialized ? ? ? ? initialized twr0mw ? ? ? ? ? ? ? twr0sw ? ? ? ? ? ? ? lpc
section 25 list of registers rev. 1.00 mar. 17, 2008 page 808 of 862 rej09b0429-0100 register abbreviation reset wdt reset high-speed/ medium-speed sleep module stop software standby hardware standby module twr1 ? ? ? ? ? ? ? twr2 ? ? ? ? ? ? ? twr3 ? ? ? ? ? ? ? twr4 ? ? ? ? ? ? ? twr5 ? ? ? ? ? ? ? twr6 ? ? ? ? ? ? ? twr7 ? ? ? ? ? ? ? twr8 ? ? ? ? ? ? ? twr9 ? ? ? ? ? ? ? twr10 ? ? ? ? ? ? ? twr11 ? ? ? ? ? ? ? twr12 ? ? ? ? ? ? ? twr13 ? ? ? ? ? ? ? twr14 ? ? ? ? ? ? ? twr15 ? ? ? ? ? ? ? idr3 ? ? ? ? ? ? ? odr3 ? ? ? ? ? ? ? str3 initialized initialized ? ? ? ? initialized sirqcr4 initialized initialized ? ? ? ? initialized ladr3h initialized initialized ? ? ? ? initialized ladr3l initialized initialized ? ? ? ? initialized sirqcr0 initialized initialized ? ? ? ? initialized sirqcr1 initialized initialized ? ? ? ? initialized idr1 ? ? ? ? ? ? ? odr1 ? ? ? ? ? ? ? str1 initialized initialized ? ? ? ? initialized sirqcr5 initialized initialized ? ? ? ? initialized idr2 ? ? ? ? ? ? ? odr2 ? ? ? ? ? ? ? str2 initialized initialized ? ? ? ? initialized hisel initialized initialized ? ? ? ? initialized lpc
section 25 list of registers rev. 1.00 mar. 17, 2008 page 809 of 862 rej09b0429-0100 register abbreviation reset wdt reset high-speed/ medium-speed sleep module stop software standby hardware standby module hicr0 initialized initialized ? ? ? ? initialized hicr1 initialized initialized ? ? ? ? initialized hicr2 initialized initialized ? ? ? ? initialized hicr3 ? ? ? ? ? ? ? sirqcr2 initialized initialized ? ? ? ? initialized btdtr ? ? ? ? ? ? ? btfvsr0 initialized initialized ? ? ? ? initialized btfvsr1 initialized initialized ? ? ? ? initialized ladr12h initialized initialized ? ? ? ? initialized ladr12l initialized initialized ? ? ? ? initialized scifadrh initialized initialized ? ? ? ? initialized scifadrl initialized initialized ? ? ? ? initialized lpc submstpbh initialized initialized ? ? ? ? initialized submstpbl initialized initialized ? ? ? ? initialized system ecs initialized initialized ? ? ? ? initialized eccr initialized initialized ? ? ? ? initialized evc mstpcra initialized initialized ? ? ? ? initialized system p6nce initialized initialized ? ? ? ? initialized p6ncmc initialized initialized ? ? ? ? initialized nccs initialized initialized ? ? ? ? initialized peodr initialized initialized ? ? ? ? initialized pfodr ? ? ? ? ? ? initialized pepin ? ? ? ? ? ? ? peddr initialized initialized ? ? ? ? initialized pfpin ? ? ? ? ? ? ? pfddr initialized ? ? ? ? ? initialized pcodr initialized initialized ? ? ? ? initialized pdodr initialized initialized ? ? ? ? initialized pcpin ? ? ? ? ? ? ? pcddr initialized initialized ? ? ? ? initialized pdpin ? ? ? ? ? ? ? pdddr initialized initialized ? ? ? ? initialized port
section 25 list of registers rev. 1.00 mar. 17, 2008 page 810 of 862 rej09b0429-0100 register abbreviation reset wdt reset high-speed/ medium-speed sleep module stop software standby hardware standby module fccs initialized initialized ? ? ? ? initialized fpcs initialized initialized ? ? ? ? initialized fecs initialized initialized ? ? ? ? initialized fkey initialized initialized ? ? ? ? initialized fmats initialized initialized ? ? ? ? initialized ftdar initialized initialized ? ? ? ? initialized flash iccr_4 initialized initialized ? ? ? ? initialized icsr_4 initialized initialized ? ? ? ? initialized icdr_4 ? ? ? ? ? ? ? sarx_4 initialized initialized ? ? ? ? initialized icmr_4 initialized initialized ? ? ? ? initialized sar_4 initialized initialized ? ? ? ? initialized iic_4 iccr_5 initialized initialized ? ? ? ? initialized icsr_5 initialized initialized ? ? ? ? initialized icdr_5 ? ? ? ? ? ? ? sarx_5 initialized initialized ? ? ? ? initialized icmr_5 initialized initialized ? ? ? ? initialized sar_5 initialized initialized ? ? ? ? initialized iic_5 smr_1 initialized initialized ? ? ? ? initialized brr_1 initialized initialized ? ? ? ? initialized scr_1 initialized initialized ? ? ? ? initialized tdr_1 initialized initialized ? ? initialized initialized initialized ssr_1 initialized initialized ? ? initialized initialized initialized rdr_1 initialized initialized ? ? initialized initialized initialized scmr_1 initialized initialized ? ? ? ? initialized sci_1 addra initialized initialized ? ? initialized initialized initialized addrb initialized initialized ? ? initialized initialized initialized addrc initialized initialized ? ? initialized initialized initialized addrd initialized initialized ? ? initialized initialized initialized addre initialized initialized ? ? initialized initialized initialized addrf initialized initialized ? ? initialized initialized initialized addrg initialized initialized ? ? initialized initialized initialized adc
section 25 list of registers rev. 1.00 mar. 17, 2008 page 811 of 862 rej09b0429-0100 register abbreviation reset wdt reset high-speed/ medium-speed sleep module stop software standby hardware standby module addrh initialized initialized ? ? initialized initialized initialized adcsr initialized initialized ? ? initialized initialized initialized adcr initialized initialized ? ? initialized initialized initialized adc smr0 initialized initialized ? ? ? ? initialized smr1 initialized initialized ? ? ? ? initialized smx p6pcr initialized initialized ? ? initialized initialized initialized pinfncr initialized initialized ? ? initialized initialized initialized p4pcr initialized initialized ? ? initialized initialized initialized iccr_3 initialized initialized ? ? ? ? initialized icsr_3 initialized initialized ? ? ? ? initialized port icdr_3 ? ? ? ? ? ? ? sarx_3 initialized initialized ? ? ? ? initialized icmr_3 initialized initialized ? ? ? ? initialized sar_3 initialized initialized ? ? ? ? initialized iccr_2 initialized initialized ? ? ? ? initialized icsr_2 initialized initialized ? ? ? ? initialized iic_3 icdr_2 ? ? ? ? ? ? ? sarx_2 initialized initialized ? ? ? ? initialized icmr_2 initialized initialized ? ? ? ? initialized sar_2 initialized initialized ? ? ? ? initialized iic_2 dadra_1 initialized initialized ? ? initialized initialized initialized dacr_1 initialized initialized ? ? initialized initialized initialized dadrb_1 initialized initialized ? ? initialized initialized initialized dacnt_1 initialized initialized ? ? initialized initialized initialized pwmx_1 crccr initialized initialized ? ? ? ? initialized crcdir initialized initialized ? ? ? ? initialized crcdor initialized initialized ? ? ? ? initialized crc icxr_0 initialized initialized ? ? ? ? initialized iic_0 icxr_1 initialized initialized ? ? ? ? initialized iic_1 icsmbcr initialized initialized ? ? ? ? initialized iic icxr_2 initialized initialized ? ? ? ? initialized iic_2
section 25 list of registers rev. 1.00 mar. 17, 2008 page 812 of 862 rej09b0429-0100 register abbreviation reset wdt reset high-speed/ medium-speed sleep module stop software standby hardware standby module icxr_3 initialized initialized ? ? ? ? initialized iic_3 iicx3 initialized initialized ? ? ? ? initialized iic icxr_4 initialized initialized ? ? ? ? initialized iic_4 icxr_5 initialized initialized ? ? ? ? initialized iic_5 kbcomp initialized initialized ? ? ? ? initialized evc icrd initialized initialized ? ? ? ? initialized icra initialized initialized ? ? ? ? initialized icrb initialized initialized ? ? ? ? initialized icrc initialized initialized ? ? ? ? initialized isr initialized initialized ? ? ? ? initialized iscrh initialized initialized ? ? ? ? initialized iscrl initialized initialized ? ? ? ? initialized int dtcera initialized initialized ? ? ? ? initialized dtcerb initialized initialized ? ? ? ? initialized dtcerc initialized initialized ? ? ? ? initialized dtcerd initialized initialized ? ? ? ? initialized dtcere initialized initialized ? ? ? ? initialized dtvecr initialized initialized ? ? ? ? initialized dtc abrkcr initialized initialized ? ? ? ? initialized bara initialized initialized ? ? ? ? initialized barb initialized initialized ? ? ? ? initialized barc initialized initialized ? ? ? ? initialized ier16 initialized initialized ? ? ? ? initialized isr16 initialized initialized ? ? ? ? initialized iscr16h initialized initialized ? ? ? ? initialized iscr16l initialized initialized ? ? ? ? initialized int issr16 initialized initialized ? ? ? ? initialized issr initialized initialized ? ? ? ? initialized ptcnt0 initialized initialized ? ? ? ? initialized port bcr2 initialized initialized ? ? ? ? initialized wscr2 initialized initialized ? ? ? ? initialized bsc
section 25 list of registers rev. 1.00 mar. 17, 2008 page 813 of 862 rej09b0429-0100 register abbreviation reset wdt reset high-speed/ medium-speed sleep module stop software standby hardware standby module pcsr initialized initialized ? ? ? ? initialized pwmx_0,1 syscr2 initialized initialized ? ? ? ? initialized sbycr initialized initialized ? ? ? ? initialized lpwrcr initialized initialized ? ? ? ? initialized mstpcrh initialized initialized ? ? ? ? initialized mstpcrl initialized initialized ? ? ? ? initialized system iccr_1 initialized initialized ? ? ? ? initialized icsr_1 initialized initialized ? ? ? ? initialized icdr_1 ? ? ? ? ? ? ? sarx_1 initialized initialized ? ? ? ? initialized icmr_1 initialized initialized ? ? ? ? initialized sar_1 initialized initialized ? ? ? ? initialized iic_1 tier initialized initialized ? ? ? ? initialized tcsr initialized initialized ? ? ? ? initialized frc initialized initialized ? ? ? ? initialized ocra initialized initialized ? ? ? ? initialized ocrb initialized initialized ? ? ? ? initialized tcr initialized initialized ? ? ? ? initialized tocr initialized initialized ? ? ? ? initialized ocrar initialized initialized ? ? ? ? initialized ocraf initialized initialized ? ? ? ? initialized frt dadra_0 initialized initialized ? ? initialized initialized initialized dacr_0 initialized initialized ? ? initialized initialized initialized dadrb_0 initialized initialized ? ? initialized initialized initialized dacnt_0 initialized initialized ? ? initialized initialized initialized pwmx_0 tcsr_0 initialized initialized ? ? ? ? initialized tcnt_0 initialized initialized ? ? ? ? initialized wdt_0 paodr initialized initialized ? ? ? ? initialized papin ? ? ? ? ? ? ? paddr initialized initialized ? ? ? ? initialized p1pcr initialized initialized ? ? ? ? initialized port
section 25 list of registers rev. 1.00 mar. 17, 2008 page 814 of 862 rej09b0429-0100 register abbreviation reset wdt reset high-speed/ medium-speed sleep module stop software standby hardware standby module p2pcr initialized initialized ? ? ? ? initialized p3pcr initialized initialized ? ? ? ? initialized p1ddr initialized initialized ? ? ? ? initialized p2ddr initialized initialized ? ? ? ? initialized p1dr initialized initialized ? ? ? ? initialized p2dr initialized initialized ? ? ? ? initialized p3ddr initialized initialized ? ? ? ? initialized p4ddr initialized ? ? ? ? ? initialized p3dr initialized initialized ? ? ? ? initialized p4dr initialized ? ? ? ? ? initialized p5ddr initialized initialized ? ? ? ? initialized p6ddr initialized initialized ? ? ? ? initialized p5dr initialized initialized ? ? ? ? initialized p6dr initialized initialized ? ? ? ? initialized pbodr initialized initialized ? ? ? ? initialized pbpin ? ? ? ? ? ? ? p8ddr initialized initialized ? ? ? ? initialized p7pin ? ? ? ? ? ? ? pbddr initialized initialized ? ? ? ? initialized p8dr initialized initialized ? ? ? ? initialized p9ddr initialized initialized ? ? ? ? initialized p9dr initialized initialized ? ? ? ? initialized port ier initialized initialized ? ? ? ? initialized int stcr initialized initialized ? ? ? ? initialized syscr initialized initialized ? ? ? ? initialized mdcr initialized initialized ? ? ? ? initialized system bcr initialized initialized ? ? ? ? initialized wscr initialized initialized ? ? ? ? initialized bsc tcr_0 initialized initialized ? ? ? ? initialized tcr_1 initialized initialized ? ? ? ? initialized tcsr_0 initialized initialized ? ? ? ? initialized tmr_0 tmr_1
section 25 list of registers rev. 1.00 mar. 17, 2008 page 815 of 862 rej09b0429-0100 register abbreviation reset wdt reset high-speed/ medium-speed sleep module stop software standby hardware standby module tcsr_1 initialized initialized ? ? ? ? initialized tcora_0 initialized initialized ? ? ? ? initialized tcora_1 initialized initialized ? ? ? ? initialized tcorb_0 initialized initialized ? ? ? ? initialized tcorb_1 initialized initialized ? ? ? ? initialized tcnt_0 initialized initialized ? ? ? ? initialized tcnt_1 initialized initialized ? ? ? ? initialized tmr_0 tmr_1 iccr_0 initialized initialized ? ? ? ? initialized icsr_0 initialized initialized ? ? ? ? initialized icdr_0 ? ? ? ? ? ? ? sarx_0 initialized initialized ? ? ? ? initialized icmr_0 initialized initialized ? ? ? ? initialized sar_0 initialized initialized ? ? ? ? initialized iic_0 smr_3 initialized initialized ? ? ? ? initialized brr_3 initialized initialized ? ? ? ? initialized scr_3 initialized initialized ? ? ? ? initialized tdr_3 initialized initialized ? ? initialized initialized initialized ssr_3 initialized initialized ? ? initialized initialized initialized rdr_3 initialized initialized ? ? initialized initialized initialized scmr_3 initialized initialized ? ? ? ? initialized sci_3 tcsr_1 initialized initialized ? ? ? ? initialized tcnt_1 initialized initialized ? ? ? ? initialized wdt_1 tcr_x initialized initialized ? ? ? ? initialized tcsr_x initialized initialized ? ? ? ? initialized tcnt_x initialized initialized ? ? ? ? initialized tcora_x initialized initialized ? ? ? ? initialized tcorb_x initialized initialized ? ? ? ? initialized tcr_y initialized initialized ? ? ? ? initialized tcsr_y initialized initialized ? ? ? ? initialized tcora_y initialized initialized ? ? ? ? initialized tcorb_y initialized initialized ? ? ? ? initialized tmr_x tmr_y
section 25 list of registers rev. 1.00 mar. 17, 2008 page 816 of 862 rej09b0429-0100 register abbreviation reset wdt reset high-speed/ medium-speed sleep module stop software standby hardware standby module tcnt_y initialized initialized ? ? ? ? initialized tconrs initialized initialized ? ? ? ? initialized tmr_x tmr_y
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 817 of 862 rej09b0429-0100 section 26 electrical characteristics 26.1 absolute maximum ratings table 26.1 lists the absolute maximum ratings. table 26.1 absolute maximum ratings item symbol value unit power supply voltage * vcc ?0.3 to +4.3 v input voltage (pins multiplexed with analog input) (1) v in ?0.3 to avcc + 0.3 input voltage (pins multiplexed with iic functions) (2) v in ?0.3 to +6.5 input voltage (pins other than (1) and (2) above) v in ?0.3 to vcc + 0.3 reference power supply voltage avref ?0.3 to avcc + 0.3 analog power supply voltage avcc ?0.3 to +4.3 analog input voltage v an ?0.3 to avcc + 0.3 operating temperature t opr ?20 to +75 (regular specifications) c ?40 to +85 (wide temperature specifications) operating temperature (when flash memory is programmed or erased) t opr 0 to +75 storage temperature t stg ?55 to +125 caution: permanent damage to this lsi may resu lt if absolute maximum ratings are exceeded. note: * voltage applied to the vcc pin. make sure power is not applied to the vcl pin.
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 818 of 862 rej09b0429-0100 26.2 dc characteristics table 26.2 lists the dc characteri stics. table 26.3 lists the permissible output currents. table 26.4 lists the bus drive characteristics. table 26.2 dc characteristics (1) conditions: vcc = 3.0 v to 3.6 v, avcc* 1 = 3.0 v to 3.6 v, avref* 1 = 3.0 v to avcc, vss = avss* 1 = 0 v item symbol min. typ. max. unit test conditions v t ? vcc 0.2 ? ? v t + ? ? vcc 0.7 event15 to event0, (ex)db7 to (ex)db0, (ex)irq15 to (ex)irq0 , etrst , xtal, excl, adtrg v t + - v t ? vcc 0.05 ? ? v t ? vcc 0.3 ? ? v t + ? ? vcc 0.7 schmitt trigger input voltage scl5 to scl0, sda5 to sda0 (1) v t + - v t ? vcc 0.05 ? ? v res , stby , nmi, fwe, md2 , md1, md0 vcc 0.9 ? vcc + 0.3 extal vcc 0.7 ? vcc + 0.3 port 7 2.2 ? avcc + 0.3 scl5 to scl0, sda5 to sda0 ? ? 5.5 clkrun , ga20, pme , lsmi , lsci, serirq, lad3 to lad0, lpcpd , lclk, lreset , lframe (2) vcc 0.5 ? vcc + 0.3 input high voltage input pins other than (1) and (2) above v ih 2.2 ? vcc + 0.3 res , stby , nmi, fwe, md2 , md1, md0 ?0.3 ? vcc 0.1 ?0.3 ? vcc 0.1 f > 25 mhz extal ?0.3 ? vcc 0.2 f 25 mhz port 7 ?0.3 ? avcc 0.2 clkrun , ga20, pme , lsmi , lsci, serirq, lad3 to lad0, lpcpd , lclk, lreset , lframe (3) ?0.3 ? vcc 0.3 input low voltage input pins other than (1) and (3) above v il ?0.3 ? vcc 0.2
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 819 of 862 rej09b0429-0100 item symbol min. typ. max. unit test conditions scl5 to scl0, sda5 to sda0, clkrun , ga20, pme , lsmi , lsc2 * 2 ? ? ? v ports 80 to 83, c0 to c5, d6, d7 * 3 0.5 ? ? i oh = ?200 a serirq, lad3 to lad0 (4) vcc 0.9 ? ? i oh = ?0.5 ma vcc ?0.5 ? ? i oh = ?200 a output high voltage output pins other than (4) above v oh vcc ?1.0 ? ? i oh = ?1 ma ? ? 0.5 i ol = 8 ma scl5 to scl0, sda5 to sda0 * 2 ? ? 0.4 i ol = 3 ma clkrun , ga20, pme , lsmi , lsci, serirq, lad3 to lad0 (5) ? ? vcc 0.1 i ol = 1.5 ma output pins other than (5) above ? ? 0.4 i ol = 1.6 ma output low voltage hc7 to hc0 v ol ? ? 1.0 i ol = 12 ma table 26.2 dc characteristics (2) conditions: vcc = 3.0 v to 3.6 v, avcc* 1 = 3.0 v to 3.6 v, avref* 1 = 3.0 v to avcc, vss = avss* 1 = 0 v item symbol min. typ. max. unit test conditions input leakage current res , stby , nmi, fwe, md2 , md1, md0 ? i in ? ? ? 1.0 a v in = 0.5 to vcc ? 0.5 v port 7 ? ? 1.0 v in = 0.5 to avcc ? 0.5 v three-state leakage current (off state) ports 1 to 6 ports 8 to f ? i tsi ? ? ? 1.0 v in = 0.5 to vcc ? 0.5 v input pull-up mos current ports 1 to 4, 6, a, d5 to d0 ?i p 20 ? 300 v in = 0 v
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 820 of 862 rej09b0429-0100 item symbol min. typ. max. unit test conditions normal operation i cc ? 45 60 ma f = 34 mhz, high-speed mode, all modules operating sleep mode ? 35 45 f = 34 mhz standby mode * 5 ? 40 100 a ta 50 c supply current * 4 ? ? 250 50 c < ta during a/d conversion aicc ? 1.0 2.0 ma analog power supply current a/d conversion standby ? 2.5 5.0 a during a/d conversion ai ref ? 0.1 1.0 ma reference power supply current a/d conversion standby ? 0.5 5.0 a input capacitance all input pin c in ? ? 10 pf v in = 0 v, f = 1 mhz, t a = 25 c ram standby voltage v ram 3.0 ? ? v vcc start voltage vcc start ? 0 0.8 v vcc rising edge svcc ? ? 20 ms/v notes: 1. do not leave the avcc, avref, and avss pins open even if the a/d converter is not used. even if the a/d converter is not used, apply a value in the range from 3.0 v to 3.6 v to the avcc and avref pins by connecting them to the power supply (vcc). the relationship between these two pins should be avref avcc. 2. an external pull-up resistor is necessary to provide high-level output from scl5 to scl0, sda5 to sda0 (ice bit in iccr is 1), clkrun , ga20, pme , lsmi , and lsci . 3. ports 80 to 83, c0 to c5, d6, and d7 are nmos push-pull outputs. high levels on ports 80 to 83, c0 to c5, d6, and d7 are driven by nmos. an external pull-up resistor is necessary to provi de high-level output from these pins when they are used as an output. 4. supply current values are for v ih min = vcc ? 0.2 v and v il max = 0.2 v with all output pins unloaded and the on-chip pull-up moss in the off state. 5. when vcc = 3.0 v, v ih min = vcc ? 0.2 v, and v il max = 0.2 v.
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 821 of 862 rej09b0429-0100 table 26.3 permissible output currents conditions: vcc = 3.0 v to 3.6 v, avcc = 3.0 v to 3.6 v, avref = 3.0 v to avcc, vss = avss = 0 v item symbol min. typ. max. unit scl5 to scl0, sda5 to sda0 ? ? 10 ma hc7 to hc0 ? ? 12 permissible output low current (per pin) other output pins i ol ? ? 1.6 total of hc7 to hc0 ? ? 48 permissible output low current (total) total of all output pins, including the above i ol ? ? 90 permissible output high current (per pin) all output pins ?i oh ? ? 2 permissible output high current (total) total of all output pins ?i oh ? ? 60 notes: 1. to protect lsi reliability, do not exceed the output current values in table 26.3. 2. when driving a darlington transistor or led, alwa ys insert a current-limiting resistor in the output line, as show in figures 26.1 and 26.2. this lsi port 2 k ? darlington transistor figure 26.1 darlington transistor drive circuit (example)
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 822 of 862 rej09b0429-0100 this lsi ports 1 to 3 led 600 ? figure 26.2 led drive circuit (example) 26.3 ac characteristics figure 26.3 shows the test conditions for the ac characteristics. 3 v r l i/o timing test levels  low level : 0.8 v  high level : 1.5 v r h c lsi output pin c = 30pf : all ports r l = 2.4 k ? r h = 12 k ? figure 26.3 output load circuit 26.3.1 clock timing table 26.4 shows the clock timing. the clock timing specified here covers clock output ( ) and clock pulse generator (crystal) and external clock input (extal pin) oscillation stabilization times. for details of external clock input (extal pin and excl pin) timing, see table 26.5 and 26.6.
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 823 of 862 rej09b0429-0100 table 26.4 clock timing condition: vcc = 3.0 v to 3.6 v, vss = 0 v, = 20 mhz to 34 mhz item symbol min. max. unit reference clock cycle time t cyc 29.4 50 ns clock high level pulse width t ch 9.7 ? clock low level pulse width t cl 9.7 ? clock rise time t cr ? 5 clock fall time t cf ? 5 figure 26.4 reset oscillation stabilization (crystal) t osc1 10 ? ms figure 26.5 software standby oscillation stabilization time (crystal) t osc2 8 ? figure 26.6 table 26.5 external clock input conditions condition: vcc = 3.0 v to 3.6 v, vss = 0 v, = 20 mhz to 34 mhz item symbol min. max. unit test conditions external clock input low level pulse width t exl 58.8 ? ns external clock input high level pulse width t exh 58.8 ? ns external clock input rising time t exr ? 5 ns external clock input falling time t exf ? 5 ns figure 26.7 clock low level pulse width t cl 0.4 0.6 t cyc clock high level pulse width t ch 0.4 0.6 t cyc figure 26.4 external clock output stabilization delay time t dext * 500 ? s figure 26.8 note: * t dext includes a res pulse width (t resw ).
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 824 of 862 rej09b0429-0100 table 26.6 subclock input conditions condition: vcc = 3.0 v to 3.6 v, vss = 0 v, = 20 mhz to 34 mhz item symbol min. typ. max. unit measureme nt condition subclock input low level pulse width t excll ? 15.26 ? s subclock input high level pulse width t exclh ? 15.26 ? s subclock input rising time t exclr ? ? 10 ns subclock input falling time t exclf ? ? 10 ns figure 26.9 clock low level pulse width t cl 0.4 ? 0.6 t cyc clock high level pulse width t ch 0.4 ? 0.6 t cyc figure 26.4 t cr t cl t cf t cyc t ch figure 26.4 system clock timing t osc1 t osc1 vcc stby res figure 26.5 oscillation stabilization timing
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 825 of 862 rej09b0429-0100 t osc2 nmi irqi ( i = 0 to 15 ) figure 26.6 oscillation stabilization ti ming (exiting soft ware standby mode) t exh t exl t exr t exf v cc 0.5 extal figure 26.7 external clock input timing
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 826 of 862 rej09b0429-0100 t dext * res (internal and external) extal stby vcc 2.7 v v ih note: the external clock output stabilization delay time (t dext ) includes a res pulse width (t resw ). figure 26.8 timing of external clock output stabilization delay time t exclh t excll t exclr t exclf v cc 0.5 excl figure 26.9 subclock input timing
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 827 of 862 rej09b0429-0100 26.3.2 control signal timing table 26.7 shows the control signal timing. only external interrupts nmi and irq0 to irq15 can be driven based on the subclock ( sub = 32.768 khz). table 26.7 control signal timing condition: vcc = 3.0 v to 3.6 v, vss = 0 v, = 20 mhz to 34 mhz item symbol min. max. unit test conditions res setup time t ress 200 ? ns res pulse width t resw 20 ? t cyc figure 26.10 nmi setup time t nmis 150 ? ns nmi hold time t nmih 10 ? nmi pulse width (exiting software standby mode) t nmiw 200 ? irq setup time ( irq15 to irq0 ) t irqs 150 ? irq hold time ( irq15 to irq0 ) t irqh 10 ? irq pulse width ( irq15 to irq0 ) (exiting software standby mode) t irqw 200 ? figure 26.11 t resw t ress t ress res figure 26.10 reset input timing
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 828 of 862 rej09b0429-0100 t irqs irq edge input t irqh t nmis t nmih t irqs irq level input nmi irqi (i = 0 to 15) t nmiw t irqw figure 26.11 int errupt input timing
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 829 of 862 rej09b0429-0100 26.3.3 bus timing table 26.8 shows the bus timing. in subclock ( sub = 32.768 khz) operation, external expansion mode operation cannot be guaranteed.
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 830 of 862 rej09b0429-0100 table 26.8 bus timing condition: vcc = 3.0 v to 3.6 v, vss = 0 v, = 20 mhz to 34 mhz item symbol min. max. unit test conditions address delay time t ad ? 14.7 ns address setup time t as 0.5 t cyc ?14.7 ? figures 26.12 to 26.19 address hold time t ah 0.5 t cyc ? 9.7 ? cs delay time ( ios , cs256 ) t csd ? 14.7 as delay time t asd ? 14.7 hbe delay time t hbd ? t ad +5.0 lbe delay time t lbd ? t ad +5.0 rd delay time 1 t rsd1 ? 14.7 rd delay time 2 t rsd2 ? 14.7 read data setup time t rds 14.7 ? read data hold time t rdh 0 ? read data access time 1 t acc1 ? 1.0 t cyc ? 29.4 read data access time 2 t acc2 ? 1.5 t cyc ? 24.7 read data access time 3 t acc3 ? 2.0 t cyc ? 29.4 read data access time 4 t acc4 ? 2.5 t cyc ? 24.7 read data access time 5 t acc5 ? 3.0 t cyc ? 29.4 wr delay time 1 t wrd1 ? 14.7 wr delay time 2 t wrd2 ? 14.7 wr pulse width 1 t wsw1 1.0 t cyc ? 19.6 ? wr pulse width 2 t wsw2 1.5 t cyc ? 19.6 ? write data delay time t wdd ? 24.7 write data setup time t wds 0 ? write data hold time t wdh 0.5 t cyc ? 5 ? wait setup time t wts 24.7 ? wait hold time t wth 5 ?
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 831 of 862 rej09b0429-0100 a23 to a0, ios * cs256 as * t rsd2 t as t ah t acc2 t rsd1 t asd t asd t ad t acc3 t rdh t wrd2 t wrd2 t wsw1 t wdd t wdh t ah t 1 t 2 rd (read) d15 to d0 (read) hwr , lwr (write) d15 to d0 (write) t rds t as t as t csd note: * as is multiplexed with ios . either the as or ios function can be selected by the iose bit of syscr. figure 26.12 basic bu s timing/2-state access
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 832 of 862 rej09b0429-0100 as * t rsd2 t as t acc4 t rsd1 t asd t asd t ad t acc5 t rdh t wrd2 t wrd1 t wsw2 t wdd t wdh t 1 t 3 rd (read) d15 to d0 (read) hwr , lwr (write) d15 to d0 (write) t wds t 2 t rds t ah t as note: * as is multiplexed with ios . either the as or ios function can be selected by the iose bit of syscr. t csd t ah a23 to a0, ios * cs256 figure 26.13 basic bu s timing/3-state access
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 833 of 862 rej09b0429-0100 as * t wth t 1 t 2 rd (read) d15 to d0 (read) hwr , lwr (write) d15 to d0 (write) wait t w t 3 t wts t wth t wts note: * as is multiplexed with ios . either the as or ios function can be selected by the iose bit of syscr. a23 to a0, ios * cs256 figure 26.14 basic bus timing/3-s tate access with one wait state
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 834 of 862 rej09b0429-0100 address [a23 to a0] as t rsd2 t as t ah t acc2 t rsd1 t asd t asd t ad t acc3 t rdh t wrd2 t wrd1 t wsw1 t wdd t wdh t ah t 1 t 2 rd read bus cycle d15 to d8 d7 to d0 d7 to d0 wr write bus cycle d15 to d8 t rds t as t as t hbd t csd ios (iose = 1) cs256 (cs256e = 1) lbe hbe l wr read bus cycle l rd write bus cycle l valid undified valid even invalid figure 26.15 even byte access (admxe = 0)
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 835 of 862 rej09b0429-0100 address [a23 to a0] as t rsd2 t as t ah t acc2 t rsd1 t asd t asd t ad t acc3 t rdh t wrd2 t wrd1 t wsw1 t wdd t wdh t ah t 1 t 2 rd read bus cycle d15 to d8 d7 to d0 d7 to d0 wr write bus cycle d15 to d8 t rds t as t as t lbd t csd ios (iose = 1) cs256 (cs256e = 1) lbe hbe l wr read bus cycle l rd write bus cycle l valid invalid odd valid undifined figure 26.16 odd byte access (admxe = 0)
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 836 of 862 rej09b0429-0100 address [a23 to a0] as t rsd2 t as t ah t acc2 t rsd1 t asd t asd t ad t acc3 t rdh t wrd2 t wrd1 t wsw1 t wdd t wdh t ah t 1 t 2 rd read bus cycle d15 to d8 d7 to d0 d7 to d0 wr write bus cycle d15 to d8 t rds t as t as t lbd t hbd t csd ios (iose = 1) cs256 (cs256e = 1) lbe hbe wr read bus cycle l rd write bus cycle l valid valid valid valid figure 26.17 word access (admxe = 0)
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 837 of 862 rej09b0429-0100 as * t rsd2 t as t ah t asd t asd t ad t acc3 t rds t rdh t 1 t 2 rd (read) d15 to d0 (read) t 2 or t 3 t 1 note: * as is multiplexed with ios . either the as or ios function can be selected by the iose bit of syscr. a23 to a0, ios * cs256 figure 26.18 burst rom a ccess timing/2-state access
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 838 of 862 rej09b0429-0100 t rsd2 t ad t acc1 t rds t rdh t 1 t 2 or t 3 t 1 as * rd (read) d15 to d0 (read) note: * as is multiplexed with ios . either the as or ios function can be selected by the iose bit of syscr. a23 to a0, ios * cs256 figure 26.19 burst rom a ccess timing/1-state access
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 839 of 862 rej09b0429-0100 26.3.4 multiplex bus timing table 26.9 shows the multiplex bus interface timing. in subclock ( sub = 32.768 khz) operation, external expansion mode operation cannot be guaranteed. table 26.9 multiplex bus timing condition: vcc = 3.0 v to 3.6 v, vss = 0 v, = 20 mhz to 34 mhz item symbol min.. max. unit test conditions address delay time t ad ? 14.7 ns figures 26.20, address setup time 2 t as2 0.5 t cyc ? 14.7 ? 26.21 address hold time 2 t ah2 0.5 t cyc ? 9.7 ? cs delay time ( ios , cs256 ) t csd ? 14.7 ah delay time t ahd ? 14.7 rd delay time 1 t rsd1 ? 14.7 rd delay time 2 t rsd2 ? 14.7 read data setup time t rds 14.7 ? read data hold time t rdh 0 ? read data access time 2 t acc2 ? 1.5 t cyc ? 24.4 read data access time 4 t acc4 ? 2.5 t cyc ? 24.4 read data access time 6 t acc6 ? 3.5 t cyc ? 24.4 read data access time 7 t acc7 ? 4.5 t cyc ? 24.4 wr delay time 1 t wrd1 ? 14.7 wr delay time 2 t wrd2 ? 14.7 wr pulse width time 1 t wsw1 1.0 t cyc ? 19.6 ? wr pulse width time 2 t wsw2 1.5 t cyc ? 19.6 ? write data delay time t wdd ? 24.4 write data setup time t wds 0 ? write data hold time t wdh 0.5 t cyc ? 5 ?
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 840 of 862 rej09b0429-0100 ah rd (read) t 1 t 2 ad15 to ad0 (read) d15 to d0 d15 to d0 a15 to a0 a15 to a0 hwr , lwr (write) ad15 to ad0 (write) t 3 t 4 t csd t ahd t rsd1 t acc2 t acc6 t as2 t ad t ad t ah2 t wrd2 t wdd t wdh t rsd2 t wrd2 t wsw1 t rds t rdh ios , cs256 figure 26.20 multiplex bus timing/data 2-state access
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 841 of 862 rej09b0429-0100 t 1 t 2 t 3 t 4 t 5 t csd t ahd t rsd1 t acc4 t acc7 t as2 t ad t ad t ah2 t wrd1 t wdd t wdh t wds t rsd2 t wrd2 t wsw2 t rds t rdh ah rd (read) ad15 to ad0 (read) d15 to d0 d15 to d0 a15 to a0 a15 to a0 hwr , lwr (write) ad15 to ad0 (write) ios , cs256 figure 26.21 multiplex bus timing/data 3-state access
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 842 of 862 rej09b0429-0100 26.3.5 timing of on-chip peripheral modules tables 26.10 to 26.13 show the on-chip peripheral module timing. the on-chip peripheral modules that can be operated by the subclock ( sub = 32.768 khz) are i/o port s, external interrupts (nmi, irq0 to irq15), watchdog timer, and 8-bit timer (channels 0 and 1) only. table 26.10 timing of on -chip peripheral modules condition: vcc = 3.0 v to 3.6 v, vss = 0 v, sub = 32.768 khz*, = 20 mhz to 34 mhz item symbol min. max. unit test conditions i/o ports output data delay time t pwd ? 29.4 ns input data setup time t prs 19.6 ? input data hold time t prh 19.6 ? figure 26.22 pwmx timer output delay time t pwod ? 29.4 ns figure 26.23 sci input clock cycle asynchronous t scyc 4 ? t cyc synchronous 6 ? input clock pulse width t sckw 0.4 0.6 t scyc input clock rise time t sckr ? 1.5 t cyc input clock fall time t sckf ? 1.5 figure 26.24 transmit data delay time (synchronous) t txd ? 29.4 ns receive data setup time (synchronous) t rxs 19.6 ? receive data hold time (synchronous) t rxh 19.6 ? figure 26.25 a/d converter trigger input setup time t trgs 19.6 ? ns figure 26.26 wdt reso output delay time t resd ? 50 ns reso output pulse width t resow 132 ? t cyc figure 26.27 note: * only the peripheral modules that can be used in subclock operation.
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 843 of 862 rej09b0429-0100 ports 1 to 9 and a to f (read) t prs t 1 t 2 t pwd t prh ports 1 to 6, 8, 9 and a to f (write) figure 26.22 i/o port input/output timing pwx3 to pwx0 t pwod figure 26.23 pwmx output timing t scyc t sckr t sckw sck1, sck3 t sckf figure 26.24 sck clock input timing sck1, sck3 txd1, txd3 (transmit data) rxd1, rxd3 (receive data) t txd t rxh t rxs figure 26.25 sci input/output timing (clock synchronous mode)
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 844 of 862 rej09b0429-0100 t trgs adtrg figure 26.26 a/d converter external trigger input timing reso t resd t resd t resow figure 26.27 wdt output timing ( reso )
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 845 of 862 rej09b0429-0100 table 26.11 i 2 c bus timing condition: vcc = 3.0 v to 3.6 v, vss = 0 v, = 20 mhz to 34 mhz item symbol min. typ. max. unit test conditions scl input cycle time t scl 12 ? ? t cyc scl input high pulse width t sclh 3 ? ? scl input low pulse width t scll 5 ? ? scl, sda input rise time t sr ? ? 7.5 * scl, sda input fall time t sf ? ? 300 ns scl, sda output fall time t of 20 + 0.1 c b ? 250 scl, sda input spike pulse elimination time t sp ? ? 1 t cyc sda input bus free time t buf 5 ? ? start condition input hold time t stah 3 ? ? repeated start condition input setup time t stas 3 ? ? stop condition input setup time t stos 3 ? ? data input setup time t sdas 0.5 ? ? data input hold time t sdah 0 ? ? ns scl, sda capacitive load c b ? ? 400 pf figure 26.28 note: * 17.5 t cyc or 37.5 t cyc can be set according to the clock selected for use by the iic module.
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 846 of 862 rej09b0429-0100 t buf t stah t stas t sp t stos t sclh t scll t sf t sr t scl t sdah t sdas p * s * sr * p * v ih v il sda0 to sda5 scl0 to scl5 note: * s, p, and sr indicate the following conditions: s: start condition p: stop condition sr: repeated start condition figure 26.28 i 2 c bus interface input/output timing table 26.12 lpc module timing conditions: vcc = 3.0 v to 3.6v, vss = 0 v, = 20 mhz to 34 mhz item symbol min. typ. max. unit test conditions input clock cycle t lcyc 30 ? ? ns figure 26.29 input clock pulse width (h) t lckh 11 ? ? input clock pulse width (l) t lckl 11 ? ? transmit signal delay time t txd 2 ? 11 transmit signal floating delay time t off ? ? 28 receive signal setup time t rxs 7 ? ? receive signal hold time t rxh 0 ? ?
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 847 of 862 rej09b0429-0100 lclk lad3 to lad0, serirq, clkrun (transmit signal) lad3 to lad0, serirq, clkrun , lframe (receive signal) t txd t rxh t rxs t off lad3 to lad0, serirq, clkrun (transmit signal) t lcyc t lckh lclk t lckl figure 26.29 lpc interface (lpc) timing
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 848 of 862 rej09b0429-0100 table 26.13 jtag timing condition: vcc = 3.0 v to 3.6 v, vss = 0 v, = 20 mhz to 34 mhz item symbol min. max. unit test conditions etck clock cycle time t tckcyc 40 * 50 * ns figure 26.30 etck clock high pulse width t tckh 15 ? etck clock low pulse width t tckl 15 ? etck clock rise time t tckr ? 5 etck clock fall time t tckf ? 5 etrst pulse width t trstw 20 ? t cyc figure 26.31 reset hold transition pulse width t rsthw 3 ? etms setup time t tmss 20 ? ns figure 26.32 etms hold time t tmsh 20 ? etdi setup time t tdis 20 ? etdi hold time t tdih 20 ? etdo data delay time t tdod ? 20 note: * when t cyc t tckcyc etck t tckcyc t tckh t tckf t tckl t tckr figure 26.30 jtag etck timing
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 849 of 862 rej09b0429-0100 etrst etck res t rsthw t trstw figure 26.31 reset hold timing etdo etdi etms etck t tmsh t tmss t tdih t tdis t tdod figure 26.32 jtag input/output timing
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 850 of 862 rej09b0429-0100 26.4 a/d conversion characteristics table 26.14 lists the a/d c onversion characteristics. table 26.14 a/d conversion characteristics (an7 to an0 input: 80/160-state conversion) condition a: vcc = 3.0 v to 3.6 v, avcc = 3.0 v to 3.6 v, avref = 3.0 v to avcc vss = avss = 0 v, = 20 mhz condition b: vcc = 3.0 v to 3.6 v, avcc = 3.0 v to 3.6 v, avref = 3.0 v to avcc, vss = avss = 0 v, = 20 mhz to 34 mhz condition a condition b item min. typ. max. min. typ. max. unit resolution 10 10 bits conversion time ? ? 4.0 * 1 ? ? 4.7 * 2 s analog input capacitance ? ? 20 ? ? 20 pf permissible signal- source impedance ? ? 5 ? ? 5 k ? nonlinearity error ? ? 7.0 ? ? 7.0 lsb offset error ? ? 7.5 ? ? 7.5 full-scale error ? ? 7.5 ? ? 7.5 quantization error ? ? 0.5 ? ? 0.5 absolute accuracy ? ? 8.0 ? ? 8.0 notes: 1. value when using the maximum operat ing frequency in single mode of 80 states. 2. value when using the maximum operating frequency in single mode of 160 states.
section 26 electrical characteristics rev. 1.00 mar. 17, 2008 page 851 of 862 rej09b0429-0100 26.5 flash memory characteristics table 26.15 lists the flas h memory characteristics. table 26.15 flash memory characteristics condition: vcc = 3.0 v to 3.6 v, avcc = 3.0 v to 3.6 v, avref = 3.0 v to avcc, vss = avss = 0 v ta = 0 c to +75 c (operating temperature range for programming/erasing in regular specifications) item symbol min. typ. max. unit test conditions programming time * 1 * 2 * 4 t p ? 1 10 ms/128 bytes erase time * 1 * 2 * 4 t e ? 40 130 ms/4-kbyte block ? 300 800 ms/32-kbyte block ? 600 1500 ms/64-kbyte block programming time (total) * 1 * 2 * 4 t p ? 9.2 24 s/512 kbytes ta = 25 c erase time (total) * 1 * 2 * 4 t e ? 9.2 24 ? ? programming and erase time (total) * 1 * 2 * 4 t pe ? 18.4 48 ? ? reprogramming count * 5 n wec 100 * 3 1000 ? times data retention time * 4 t drp 10 ? ? years notes: 1. programming and eras e time depends on the data. 2. programming and erase time do not include data transfer time. 3. this value indicates the minimum number of which the flash memory are reprogrammed with all characteristics guaran teed. (the guaranteed value ranges from 1 to the minimum number.) 4. this value indicates the characteristics while the flash memory is reprogrammed within the specified range (including the minimum number). 5. reprogramming count in each erase block.
section 26 electric al characteristics rev. 1.00 mar. 17, 2008 page 852 of 862 rej09b0429-0100 26.6 usage notes it is necessary to connect a bypass capacitor between the vcc pin and vss pin and a capacitor between the vcl pin and vss pin for stable internal step-down power. an example of connection is shown in figure 26.33. external capacitor for internal step-down power stabilization one 0.1 f / 0.47 f or two in parallel it is recommended that a bypass capacitor be connected to the vcc pin. (the values are reference values.) when connecting, place a bypass capacitor near the pin. vcl vcc vcc power supply vss vss 0.01 f bypass capacitor 10 f do not connect vcc power supply to the vcl pin. always connect a capacitor for internal step-down power stabilization. use one or two ceramic multilayer capacitor(s) (0.1 f / 0.47 f: connect in parallel when using two) and place it (them) near the pin. figure 26.33 connecting capacitors to vcc and vcl pins
appendix rev. 1.00 mar. 17, 2008 page 853 of 862 rej09b0429-0100 appendix a. i/o port states in each processing state table a.1 i/o port states in each processing state mcu operating mode port name pin name expe setting reset hardware standby mode software standby mode sleep mode program execution state port 1 0 / 1 (ddr=0) kept kept i/o port a7 to a0 1 (ddr=1) t t kept* kept* address output port 2 0 / 1 (ddr=0) kept kept i/o port a15 to a8 1 (ddr=1) t t kept* kept* address output port 3 0 kept kept i/o port d15 to d8 1 t t t t d15 to d8 port 4 0 t t kept kept i/o port port 5 x t t kept kept i/o port port 6 0 / 1 (8 bits) kept kept i/o port d7 to d0 1 (16 bits) t t t t d7 to d0 port 7 x t t t t input port port 8 x t t kept kept i/o port port 97 0 kept kept i/o port wait 1 (cs256e=0) t t t t wait cs256 1 (cs256e=1) h h cs256 port 96 0 input port excl 1 (ddr=0) t t excl 1 (ddr=1) t t h output port 95 0 kept kept i/o port as , ios 1 t t h h as / ios port 94 0 kept kept i/o port wr , hwr 1 t t h h wr , hwr port 93 0 kept kept i/o port rd 1 t t h h rd
appendix rev. 1.00 mar. 17, 2008 page 854 of 862 rej09b0429-0100 mcu operating mode port name pin name expe setting reset hardware standby mode software standby mode sleep mode program execution state port 92 0 kept kept i/o port hbe 1 t t h h hbe port 91 0 / 1 (admxe=0) kept kept i/o port ah 1 (admxe=1) t t h h ah port 90 0 / 1 (8 bits) kept kept i/o port lwr , lbe 1 (16 bits) t t h h lwr , lbe port a7 to a2 0 / 1 (address 18=1) kept kept i/o port a23 to a18 1 (address 18=0) t t kept* kept* a23 to a18 port a1, a0 0 / 1 (address 13=1) kept kept i/o port a17, a16 1 (address 13=0) t t kept* kept* a17, a16 port b x t t kept kept i/o port port c x t t kept kept i/o port port d x t t kept kept i/o port port e x t t kept kept i/o port port f x t t kept kept i/o port legend h: high level l: low level t: high impedance x: don?t care kept: input port pins are in the high-impedance state (when ddr = 0 and pcr = 1, the input pull- up mos remains on). output port pins retain their states. functions of some pins wi ll be changed to the i/o port func tion, which is determined by ddr and dr, because the on-chip peripheral modu le associated with that pin function is initialized. ddr: data direction register note: * in the case of address output, the last address accessed is retained.
appendix rev. 1.00 mar. 17, 2008 page 855 of 862 rej09b0429-0100 b. product lineup product type type code mark code package (code) h8s/2164 f-ztat version (regular specifications) R4F2164 f2164vte34v 144-pin tfp (tfp-144) h8s/2164 f-ztat version (wide temperature specifications) R4F2164 f2164vte34wv 144-pin tfp (tfp-144) c. package dimensions note) 1. dimensions" * 1"and" * 2" do not include mold flash 2. dimension" * 3"does not include trim offset. 1.0 16 1.0 1.0 0.08 0 8 0.4 0.12 0.17 0.22 0.13 0.18 0.23 0.05 0.10 0.15 1.20 17.8 18.0 18.2 1.00 16 0.16 0.15 0.4 0.5 0.6 0.07 18.2 18.0 17.8 reference symbol dimension in millimeters min nom max l 1 z e z d y x c b 1 b p a h d a 2 e d a 1 c 1 e e l h e index mark * 1 * 2 * 3 73 72 108 109 37 36 1 144 f xm y d e d e p z z b d h e h detail f 1 1 2 c l a a l a terminal cross section 1 1 p b c c b p-tqfp144-16x16-0.40 0.6g mass[typ.] tfp-144/tfp-144v ptqp0144lc-a renesas code jeita package code previous code figure c.1 package dimensions (tqfp-144)
appendix rev. 1.00 mar. 17, 2008 page 856 of 862 rej09b0429-0100
rev. 1.00 mar. 17, 2008 page 857 of 862 rej09b0429-0100 index numerics 14-bit pwm timer (pwmx)................... 255 16-bit count mode ................................... 304 16-bit free-running timer (frt) ............. 271 16-bit, 2-state access space ..................... 125 16-bit, 3-state access space ..................... 128 256-kbyte expansion area ....................... 113 8-bit timer (tmr) ................................... 289 8-bit, 2-state access space ....................... 123 8-bit, 3-state access space ....................... 124 a a/d conversion time............................... 631 a/d converter ......................................... 621 absolute address....................................... 46 acknowle dge .......................................... 482 activation by interrupt............................ 175 activation by software............................ 175 address map ............................................. 61 address ranges and external address spaces......................................... 111 address space ........................................... 24 adi ......................................................... 635 advanced mode ................................ 22, 117 arithmetic operations instructions............ 36 asynchronou s mode ............................... 347 b basic expansion area............................... 112 basic operation timing............................ 146 bcc...................................................... 33, 41 bit manipulation instructions.................... 39 bit rate .................................................... 343 block sata transfer instructions................. 43 block transf er mode................................ 170 boot m ode............................................... 674 boundary scan......................................... 756 branch instructions ................................... 41 burst rom interface............................... 146 bus controller (bsc)................................ 99 bus specifications of basic bus interface ............................................ 112 c cascaded connection............................... 304 chain transfer.......................................... 171 clock pulse generator.............................. 763 clocked synchr onous m ode .................... 365 cmia ...................................................... 305 cmia0 .................................................... 305 cmia1 .................................................... 305 cmiax ................................................... 305 cmiay ................................................... 305 cmib ...................................................... 305 cmib0 .................................................... 305 cmib1 .................................................... 305 cmibx ................................................... 305 cmiby ................................................... 305 communications protoc ol ....................... 712 compare-match count mode ................... 304 condition field .......................................... 44 condition-code register (ccr) ................. 28 conversion cycle..................................... 263 cpu operating modes ............................... 20 crc operation circuit ............................. 397 crystal oscillator ..................................... 764 d data direction register............................. 179 data register ............................................ 179
rev. 1.00 mar. 17, 2008 page 858 of 862 rej09b0429-0100 data transfer controller (dtc) ............... 151 data transfer instructions.......................... 35 download pass/fail result parameter....... 664 dtc vector table .................................... 165 e effective address................................. 45, 49 effective address extension ...................... 44 eri1........................................................ 386 eri2........................................................ 386 error protection ...................................... 706 exception handling ................................... 63 exception handling vector table ............... 64 extended control register (exr) .............. 27 external clock......................................... 765 f flash erase block select parameter.......... 671 flash mat configuration ....................... 647 flash multipurpose address area parameter ................................................ 668 flash multipurpose data destination parameter ................................................ 668 flash pass/fail parameter ........................ 672 flash programming/erasing frequency parameter ................................................ 666 fovi....................................................... 282 framing error.......................................... 354 g general registers ....................................... 26 h hardware protection ............................... 704 hardware standby mode ......................... 783 i i/o ports .................................................. 179 i/o select signals ..................................... 118 i 2 c bus formats ....................................... 481 i 2 c bus interface (iic)............................. 449 immediate ................................................. 47 input pull-up mos control register......... 179 input pull-u p moss ................................ 179 instruction set............................................ 33 interface .................................................. 327 internal block diagram ................................ 2 interrupt control modes............................. 84 interrupt controller .................................... 71 interrupt exception handling ..................... 68 interrupt exception handling sequence...... 91 interrupt exception handling vector table................................................ 82 interrupt mask bit...................................... 28 interrupt mask level .................................. 27 interval timer mode................................. 320 irq15 to irq0 interrupts ......................... 80 l logic operations instructions .................... 38 lpc interface (lpc) ............................... 529 lpc interface clock start request ............ 613 lsi internal states in each mode ............. 778 m master receive operation......................... 487 master transmit operation ....................... 483 medium-speed mode............................... 779 memory indirect ....................................... 48 mode comparison ................................... 646 mode transition diagram ......................... 777 module st op mode .................................. 784 multiply-accumulate register (mac) ....... 29
rev. 1.00 mar. 17, 2008 page 859 of 862 rej09b0429-0100 multiprocessor communication function................................................... 358 n nmi interrupt............................................ 80 normal mode ............................ 20, 168, 176 number of dtc execution states............ 173 o on-board pr ogramming .......................... 673 on-board progra mming mode ................ 643 operating modes....................................... 55 operation field .......................................... 44 output compare ...................................... 279 overflow................................................. 318 overrun error .......................................... 354 ovi0 ....................................................... 305 ovi1 ....................................................... 305 ovix ...................................................... 305 oviy ...................................................... 305 p parity error.............................................. 354 pin arrangement .......................................... 3 pin functions ............................................. 10 power-down modes ................................ 769 procedure program.................................. 694 program counter (pc) ............................... 27 program-counter relative .......................... 47 programmer mode .................................. 709 programming/erasing interface register .................................................... 654 protection................................................ 704 r ram ....................................................... 641 register direct ........................................... 45 register field............................................. 44 register indirect ........................................ 45 register indirect with displacement .......... 46 register indirect with post-increment ....... 46 register indirect with pre-decrement ........ 46 registers abrkcr .............................................. 74 adcr ................................................. 627 adcsr ............................................... 625 addr ................................................. 624 bara ................................................... 75 barb.................................................... 75 barc .................................................... 75 brr .................................................... 343 btcr .................................................. 591 btcsr................................................ 588 btdtr ............................................... 594 btfvsr ............................................. 596 btimsr.............................................. 594 btsr .................................................. 582 cra .................................................... 156 crb .................................................... 156 crccr ............................................... 398 crcdir.............................................. 399 crcdor ............................................ 399 dacnt............................................... 257 dacr ................................................. 260 dadra .............................................. 258 dadrb .............................................. 258 dar .................................................... 155 dtcer ............................................... 156 dtcera............................................. 157 dtcerb............................................. 157 dtcerc............................................. 157 dtcerd............................................. 157 dtcere ............................................. 157 dtvecr............................................. 157
rev. 1.00 mar. 17, 2008 page 860 of 862 rej09b0429-0100 fccs .................................................. 654 fdlh.................................................. 410 fdll .................................................. 410 fecs................................................... 658 ffcr .................................................. 414 fier ................................................... 411 fiir..................................................... 412 fkey.................................................. 659 flcr .................................................. 415 flsr................................................... 418 fmats............................................... 660 fmcr ................................................. 416 fmsr ................................................. 422 fpcs................................................... 658 frbr.................................................. 409 frc .................................................... 273 frsr .................................................. 409 fscr .................................................. 422 ftdar ............................................... 661 fthr.................................................. 410 ftsr................................................... 409 hicr................................................... 535 hisel................................................. 575 iccr ................................................... 462 icdr................................................... 453 icmr.................................................. 457 icra..................................................... 74 icrb..................................................... 74 icrc ..................................................... 74 icrd..................................................... 74 icsmbcr .......................................... 479 icsr ................................................... 471 icxr................................................... 475 idr ..................................................... 553 ier........................................................ 78 ier16.................................................... 78 iic3..................................................... 459 iscr ..................................................... 76 iscr16h .............................................. 76 iscr16l............................................... 76 iscrh................................................... 77 iscrl ................................................... 77 isr ........................................................ 79 isr16 .................................................... 79 issr .................................................... 251 issr16 ................................................ 251 kbcomp............................................ 153 ladr12.............................................. 548 ladr3 ............................................... 550 lpcpd ................................................ 607 lpwrcr ............................................ 772 mdcr................................................... 56 mra ................................................... 154 mrb ................................................... 155 mstpcra.......................................... 775 mstpcrh.......................................... 774 mstpcrl .......................................... 774 ocia................................................... 282 ocib................................................... 282 ocra ................................................. 273 ocraf ............................................... 274 ocrar............................................... 274 ocrb ................................................. 273 odr .................................................... 553 p1ddr................................................ 184 p1dr................................................... 185 p1pcr................................................. 185 p2ddr................................................ 187 p2dr................................................... 188 p2pcr......................................... 188, 204 p3ddr........................................ 191, 231 p3dr........................................... 192, 232 p3pcr................................................. 192 p4ddr................................................ 194 p4dr................................................... 195 p4pcr................................................. 195 p5ddr................................................ 197 p5dr................................................... 198 p6ddr................................................ 203 p6dr................................................... 204
rev. 1.00 mar. 17, 2008 page 861 of 862 rej09b0429-0100 p7pin.......................................... 211, 232 p8ddr........................................ 216, 221 p8dr .......................................... 217, 222 paddr............................................... 226 paodr............................................... 227 papin................................................. 227 pcddr....................................... 234, 239 pcodr....................................... 235, 240 pcpin......................................... 235, 240 pcsr .................................................. 261 peddr ....................................... 244, 249 peodr ....................................... 245, 249 pepin ......................................... 245, 250 pinfncr ........................................... 548 ptcnt0.............................................. 253 rdr .................................................... 331 rsr..................................................... 331 sar ............................................ 155, 454 sarx.................................................. 455 sbycr ............................................... 770 scifadr ........................................... 576 scifcr .............................................. 423 scmr ................................................. 342 scr..................................................... 335 sdbpr................................................ 746 sdbsr ................................................ 746 sdidr ................................................ 754 sdir ................................................... 745 serirq .............................................. 611 sirqcr.............................................. 563 smiccs r ........................................... 578 smicdtr .......................................... 578 smicflg ........................................... 577 smicir .............................................. 579 smr.................................................... 332 smr0.................................................. 441 smr1.................................................. 442 ssr ..................................................... 338 stcr .................................................... 58 str..................................................... 555 submstpbh..................................... 776 submstpbl ..................................... 776 syscr.................................................. 57 syscr2.............................................. 109 tcnt .......................................... 292, 313 tconrs............................................. 301 tcora ............................................... 293 tcorb ............................................... 293 tcr............................................. 277, 294 tcsr .......................... 276, 297, 298, 314 tdr .................................................... 331 tier.................................................... 275 tocr.................................................. 278 tsr ..................................................... 331 twr.................................................... 554 repeat mode............................................ 169 reset.......................................................... 66 reset exception handling .......................... 66 rxi1........................................................ 386 rxi2........................................................ 386 s sample-and-hold circuit.......................... 631 scan mode............................................... 629 scif control from lpc interface........... 613 serial communication interface (sci)..... 327 serial communication interface specification ............................................ 710 serial communication interface with fifo (scif).................................... 405 serial data reception........................ 354, 370 serial data transmission .................. 352, 367 serial formats .......................................... 481 shift instructions ....................................... 38 single mode ............................................ 628 slave address........................................... 482 slave receive operation ........................... 496 slave transmit operation.......................... 504 sleep mode.............................................. 780
rev. 1.00 mar. 17, 2008 page 862 of 862 rej09b0429-0100 smart card............................................... 327 software protection................................. 706 software standby mode .......................... 781 stack pointer (sp)..................................... 26 stack status ............................................... 69 start condition ........................................ 482 stop condition......................................... 482 system control instructions....................... 42 t tap controller ........................................ 755 tei1........................................................ 386 tei2........................................................ 386 trace bit.................................................... 27 transfer rate............................................ 460 trap instruction exception handling ......... 68 trapa instruction ............................. 47, 68 txi1 ....................................................... 386 txi2 ....................................................... 386 u user boot mat....................................... 708 user boot mode....................................... 689 user mat ............................................... 708 user program mode ................................ 678 v vector number for the software activation interrupt .................................. 157 w wait control ............................................ 147 watchdog time r (wdt).......................... 311 watchdog ti mer mode............................. 318 wovi ..................................................... 322
renesas 16-bit single-chip microcomputer hardware manual h8s/2164 group publication date: rev.1.00, mar. 17, 2008 published by: sales strategic planning div. renesas technology corp. edited by: customer support department global strategic communication div. renesas solutions corp. ? 2008. renesas technology corp., all rights reserved. printed in japan.
sales strategic planning div. nippon bldg., 2-6-2, ohte-machi, chiyoda-ku, tokyo 100-0004, japan http://www.renesas.com refer to " http://www.renesas.com/en/network " for the latest and detailed information. renesas technology america, inc. 450 holger way, san jose, ca 95134-1368, u.s.a tel: <1> (408) 382-7500, fax: <1> (408) 382-7501 renesas technology europe limited dukes meadow, millboard road, bourne end, buckinghamshire, sl8 5fh, u.k. tel: <44> (1628) 585-100, fax: <44> (1628) 585-900 renesas technology (shanghai) co., ltd. unit 204, 205, aziacenter, no.1233 lujiazui ring rd, pudong district, shanghai, china 200120 tel: <86> (21) 5877-1818, fax: <86> (21) 6887-7858/7898 renesas technology hong kong ltd. 7th floor, north tower, world finance centre, harbour city, canton road, tsimshatsui, kowloon, hong kong tel: <852> 2265-6688, fax: <852> 2377-3473 renesas technology taiwan co., ltd. 10th floor, no.99, fushing north road, taipei, taiwan tel: <886> (2) 2715-2888, fax: <886> (2) 3518-3399 renesas technology singapore pte. ltd. 1 harbour front avenue, #06-10, keppel bay tower, singapore 098632 tel: <65> 6213-0200, fax: <65> 6278-8001 renesas technology korea co., ltd. kukje center bldg. 18th fl., 191, 2-ka, hangang-ro, yongsan-ku, seoul 140-702, korea tel: <82> (2) 796-3115, fax: <82> (2) 796-2145 renesas technology malaysia sdn. bhd unit 906, block b, menara amcorp, amcorp trade centre, no.18, jln persiaran barat, 46050 petaling jaya, selangor darul ehsan, m alaysia tel: <603> 7955-9390, fax: <603> 7955-9510 renesas sales offices colophon 6.2

h8s/2164 group hardware manual


▲Up To Search▲   

 
Price & Availability of R4F2164

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X